GetItemVendorList


Description

Retrieves a list of item vendor summary objects that meet the specified criteria.

Parameters

Parameter

Type

Description

criteria

ItemVendorCriteria

The item vendor criteria object that specifies which item vendor summary objects to retrieve.

context

Context

Specifies information about how the method will be called.


Return Value:

Value

Type

Description

GetItemVendorListResult

ArrayOfItemVendorSummary

A list of the item vendor summary objects that match the specified criteria.


Interfaces

 

Examples

The following C# example retrieves the list of item vendor summary objects for the vendor with a key of “ACETRAVE0001”. The example lists all items supplied by the specified vendor. A message box displays the vendor’s item description for each member of the list.

 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 vendorRestriction;
			LikeRestrictionOfString itemRestriction;
			ItemVendorCriteria itemVendorCriteria;
			ItemVendorSummary[] itemVendorSummaries;

			// 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 for vendor
			// Specify a single vendor
			vendorRestriction = new LikeRestrictionOfString();
			vendorRestriction.EqualValue = "ACETRAVE0001";

			// Create a restriction object for items
			// Get all available items
			itemRestriction = new LikeRestrictionOfString();
			itemRestriction.Like = "%";

			// Create an item vendor criteria object
			itemVendorCriteria = new ItemVendorCriteria();
			itemVendorCriteria.VendorId = vendorRestriction;
			itemVendorCriteria.ItemId = itemRestriction;

			// Retrieve the list of item vendor summary objects
			itemVendorSummaries = wsDynamicsGP.GetItemVendorList(itemVendorCriteria, context);

			// Display the item description property of each member of the summary object list
			StringBuilder summaryList = new StringBuilder();
			foreach(ItemVendorSummary a in itemVendorSummaries)
			{
				summaryList.AppendLine("Item description: " + a.VendorItemDescription);
		}
			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 vendorRestriction;
			LikeRestrictionOfstring itemRestriction;
			ItemVendorCriteria itemVendorCriteria;
			ItemVendorSummary[] itemVendorSummaries;

			// 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 for vendor
			// Specify a single vendor
			vendorRestriction = new LikeRestrictionOfstring();
			vendorRestriction.EqualValue = "ACETRAVE0001";

			// Create a restriction object for items
			// Get all available items
			itemRestriction = new LikeRestrictionOfstring();
			itemRestriction.Like = "%";

			// Create an item vendor criteria object
			itemVendorCriteria = new ItemVendorCriteria();
			itemVendorCriteria.VendorId = vendorRestriction;
			itemVendorCriteria.ItemId = itemRestriction;

			// Retrieve the list of item vendor summary objects
			itemVendorSummaries = wsDynamicsGP.GetItemVendorList(itemVendorCriteria, context);

			// Display the item description property of each member of the summary object list
			StringBuilder summaryList = new StringBuilder();
			foreach(ItemVendorSummary a in itemVendorSummaries)
			{
				summaryList.AppendLine("Item description: " + a.VendorItemDescription);
		}
			MessageBox.Show(summaryList.ToString());

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


Documentation Feedback