GetVendorAddressList


Description

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

Parameters

Parameter

Type

Description

criteria

VendorAddressCriteria

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

context

Context

Specifies information about how the method will be called.


Return Value:

Value

Type

Description

GetVendorAddressListResult

ArrayOfVendorAddressSummary

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


Interfaces

 

Examples

The following C# example retrieves the list of vendor address summary objects where the vendor is located in a state that begins with ā€œNā€. The list of vendors and states 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;
			VendorAddressSummary[] vendorAddressList;
			VendorAddressCriteria vendorAddressCriteria;
			LikeRestrictionOfString stateRestriction;

			// Create an instance of the service
			DynamicsGP wsDynamicsGP = new DynamicsGP();

			// Be sure the default credentials are being 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 vendor address criteria object
			stateRestriction = new LikeRestrictionOfString();
			stateRestriction.Like = "N%";
			vendorAddressCriteria = new VendorAddressCriteria();
			vendorAddressCriteria.State = stateRestriction;

			// Get the list of vendor address objects
			vendorAddressList = wsDynamicsGP.GetVendorAddressList(vendorAddressCriteria, context);

			// Display the vendors located in the specified state
			StringBuilder objectList = new StringBuilder();
			foreach (VendorAddressSummary a in vendorAddressList)
			{
				// Build the string to display
				objectList.AppendLine(a.State + "  " + a.Key.VendorKey.Id);
		}

			MessageBox.Show(objectList.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;
			VendorAddressSummary[] vendorAddressList;
			VendorAddressCriteria vendorAddressCriteria;
			LikeRestrictionOfstring stateRestriction;

			// 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 vendor address criteria object
			stateRestriction = new LikeRestrictionOfstring();
			stateRestriction.Like = "N%";
			vendorAddressCriteria = new VendorAddressCriteria();
			vendorAddressCriteria.State = stateRestriction;

			// Get the list of vendor address objects
			vendorAddressList = wsDynamicsGP.GetVendorAddressList(vendorAddressCriteria, context);

			// Display the vendors located in the specified state
			StringBuilder objectList = new StringBuilder();
			foreach (VendorAddressSummary a in vendorAddressList)
			{
				// Build the string to display
				objectList.AppendLine(a.State + "  " + a.Key.VendorKey.Id);
		}

			MessageBox.Show(objectList.ToString());

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


Documentation Feedback