Retrieves a list of vendor summary objects that match the specified criteria.
Parameter |
Type |
Description |
---|---|---|
criteria |
The vendor criteria object that specifies which vendor summary objects are returned. |
|
context |
Specifies information about how the method will be called. |
Value |
Type |
Description |
---|---|---|
GetVendorListResult |
The list of vendor summary objects that match the specified criteria. |
The following C# example retrieves the list of vendor summary objects for the vendors whose Vendor Class Id property equals “USA-US-I”. The total number of vendors in the vendor class 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; VendorCriteria vendorCriteria; VendorSummary[] vendorSummaryList; LikeRestrictionOfString classIdRestriction; // Create an instance of the service DynamicsGP wsDynamicsGP = new DynamicsGP(); // Be sure that default credentials are being used wsDynamicsGP.UseDefaultCredentials = true; // Create a context object 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; // Specify the criteria for the vendor summaries to retrieve classIdRestriction = new LikeRestrictionOfString(); classIdRestriction.EqualValue = "USA-US-I"; vendorCriteria = new VendorCriteria(); vendorCriteria.ClassId = classIdRestriction; // Retrieve the list of vendor summaries vendorSummaryList = wsDynamicsGP.GetVendorList(vendorCriteria, context); MessageBox.Show("Total vendors in class: " + vendorSummaryList.Length); } } }
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; VendorCriteria vendorCriteria; VendorSummary[] vendorSummaryList; LikeRestrictionOfstring classIdRestriction; // Create an instance of the service DynamicsGPClient wsDynamicsGP = new DynamicsGPClient(); // Create a context object 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; // Specify the criteria for the vendor summaries to retrieve classIdRestriction = new LikeRestrictionOfstring(); classIdRestriction.EqualValue = "USA-US-I"; vendorCriteria = new VendorCriteria(); vendorCriteria.ClassId = classIdRestriction; // Retrieve the list of vendor summaries vendorSummaryList = wsDynamicsGP.GetVendorList(vendorCriteria, context); MessageBox.Show("Total vendors in class: " + vendorSummaryList.Length); // Close the service if(wsDynamicsGP.State != CommunicationState.Faulted) { wsDynamicsGP.Close(); } } } }