Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Description
Retrieves a single employee address object based on the specified employee address key.
Parameters
Parameter |
Type |
Description |
|---|---|---|
key |
The employee address key object that specifies the employee address to retrieve. |
|
context |
Specifies information about how the method will be called. |
Return Value:
Value |
Type |
Description |
|---|---|---|
GetEmployeeAddressByKeyResult |
An employee address object. |
Interfaces
- Dynamics GP
- Human Resources/Payroll
Examples
The following C# example retrieves the employee address for the employee"ACKE0001" where the address Id is "Test address". The address information is displayed in a message box.
** Legacy endpoint**
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using DynamicsGPWebServiceSample.DynamicsGPService;
namespace DynamicsGPWebServiceSample
{
class Program
{
static void Main(string[] args)
{
CompanyKey companyKey;
Context context;
EmployeeKey employeeKey;
EmployeeAddressKey employeeAddressKey;
EmployeeAddress employeeAddress;
// Create an instance of the service
DynamicsGP wsDynamicsGP = new DynamicsGP();
// Be sure the default credentials are used
wsDynamicsGP.UseDefaultCredentials = true;
// Create a context with which to call the service
context = new Context();
// Specify which company to use (sample company)
companyKey = new CompanyKey();
companyKey.Id = (-1);
// Set up the context object
context.OrganizationKey = (OrganizationKey)companyKey;
// Create an employee key
employeeKey = new EmployeeKey();
employeeKey.Id = "ACKE0001";
// Create an employee address key
employeeAddressKey = new EmployeeAddressKey();
employeeAddressKey.EmployeeKey = employeeKey;
employeeAddressKey.Id = "Test address";
// Get the specified employee address object
employeeAddress = wsDynamicsGP.GetEmployeeAddressByKey(employeeAddressKey, context);
// Display data from the employee address
MessageBox.Show("Address type: " + employeeAddress.Key.Id + " Location: " + employeeAddress.State);
}
}
}
** Native endpoint **
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
using System.Windows.Forms;
using DynamicsGPWebServiceSample.DynamicsGPService;
namespace DynamicsGPWebServiceSample
{
class Program
{
static void Main(string[] args)
{
CompanyKey companyKey;
Context context;
EmployeeKey employeeKey;
EmployeeAddressKey employeeAddressKey;
EmployeeAddress employeeAddress;
// Create an instance of the service
DynamicsGPClient wsDynamicsGP = new DynamicsGPClient();
// Create a context with which to call the service
context = new Context();
// Specify which company to use (sample company)
companyKey = new CompanyKey();
companyKey.Id = (-1);
// Set up the context object
context.OrganizationKey = (OrganizationKey)companyKey;
// Create an employee key
employeeKey = new EmployeeKey();
employeeKey.Id = "ACKE0001";
// Create an employee address key
employeeAddressKey = new EmployeeAddressKey();
employeeAddressKey.EmployeeKey = employeeKey;
employeeAddressKey.Id = "Test address";
// Get the specified employee address object
employeeAddress = wsDynamicsGP.GetEmployeeAddressByKey(employeeAddressKey, context);
// Display data from the employee address
MessageBox.Show("Address type: " + employeeAddress.Key.Id + " Location: " + employeeAddress.State);
// Close the service
if(wsDynamicsGP.State != CommunicationState.Faulted)
{
wsDynamicsGP.Close();
}
}
}
}