GetEmployeeAddressList


Description

Retrieves a list of employee address summary objects that match the specified criteria.

Parameters

Parameter

Type

Description

criteria

EmployeeAddressCriteria

The employee address criteria object that specifies which employee address summary objects are returned.

context

Context

Specifies information about how the method will be called.


Return Value:

Value

Type

Description

GetEmployeeAddressListResult

ArrayOfEmployeeAddressSummary

The list of employee address summary objects that match the specified criteria.


Interfaces

 

Examples

The following C# example retrieves the list of employee address summary objects for employees whose Id property begins with “A”. Information from each address summary 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;
			LikeRestrictionOfString employeeIdRestriction;
			EmployeeAddressCriteria employeeAddressCriteria;
			EmployeeAddressSummary[] employeeAddressList;

			// 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 a restriction object
			// Retrieve address summary objects for employees that begin with 'A'
			employeeIdRestriction = new LikeRestrictionOfString();
			employeeIdRestriction.Like = "A%";

			// Create the criteria object and specify the criteria restriction
			employeeAddressCriteria = new EmployeeAddressCriteria();
			employeeAddressCriteria.EmployeeKeyId = employeeIdRestriction;

			// Retrieve the list of employee address summary objects
			employeeAddressList = wsDynamicsGP.GetEmployeeAddressList(employeeAddressCriteria, context);

			// Display the employee address and on order amount for members of the 
			// customer receivables summary list that have an on order balance
			StringBuilder summaryList = new StringBuilder();
			foreach (EmployeeAddressSummary a in employeeAddressList)
			{
				if (a.State.Length > 0)
				{
					summaryList.AppendLine("Employee: " + a.Key.EmployeeKey.Id 
						+ "   Address title: " + a.Key.Id
						+ "   State: " + a.State);
			}
		}
			MessageBox.Show(summaryList.ToString());
	}
}
}

 Native endpoint

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DynamicsGPWebServiceSample.DynamicsGPService;

namespace DynamicsGPWebServiceSample
{
	class Program
	{
		static void Main(string[] args)
		{
			CompanyKey companyKey;
			Context context;
			LikeRestrictionOfstring employeeIdRestriction;
			EmployeeAddressCriteria employeeAddressCriteria;
			EmployeeAddressSummary[] employeeAddressList;

			// 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 a restriction object
			// Retrieve address summary objects for employees that begin with 'A'
			employeeIdRestriction = new LikeRestrictionOfstring();
			employeeIdRestriction.Like = "A%";

			// Create the criteria object and specify the criteria restriction
			employeeAddressCriteria = new EmployeeAddressCriteria();
			employeeAddressCriteria.EmployeeKeyId = employeeIdRestriction;

			// Retrieve the list of employee address summary objects
			employeeAddressList = wsDynamicsGP.GetEmployeeAddressList(employeeAddressCriteria, context);

			// Display the employee address and on order amount for members of the 
			// customer receivables summary list that have an on order balance
			StringBuilder summaryList = new StringBuilder();
			foreach (EmployeeAddressSummary a in employeeAddressList)
			{
				if (a.State.Length > 0)
				{
					summaryList.AppendLine("Employee: " + a.Key.EmployeeKey.Id 
						+ "   Address title: " + a.Key.Id
						+ "   State: " + a.State);
			}
		}
			MessageBox.Show(summaryList.ToString());

			// Close the service
			if(wsDynamicsGP.State != CommunicationState.Faulted)
			{
				wsDynamicsGP.Close();
		}
	}
}
}


Documentation Feedback