Retrieves a list of inventoried item summary objects that meet the specified criteria.
Parameter |
Type |
Description |
---|---|---|
criteria |
The inventoried item criteria object that specifies which inventoried item summary objects to retrieve. |
|
context |
Specifies information about how the method will be called. |
Value |
Type |
Description |
---|---|---|
GetInventoriedItemListResult |
A list of the inventoried item summary objects that match the specified criteria. |
The following C# example retrieves the list of inventoried item summary objects with a item class Id of “ATT CORD”. A message box displays the description of each member of the inventoried item summary objects 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 classIdRestriction; InventoriedItemCriteria inventoryItemCriteria; InventoriedItemSummary[] inventoryItemSummaries; // 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 the restriction object // Get items with an item class Id of 'ATT CORD' classIdRestriction = new LikeRestrictionOfString(); classIdRestriction.EqualValue = "ATT CORD"; // Create the inventoried item criteria object inventoryItemCriteria = new InventoriedItemCriteria(); inventoryItemCriteria.ItemClassId = classIdRestriction; // Retrieve the list of inventoried item summary objects inventoryItemSummaries = wsDynamicsGP.GetInventoriedItemList(inventoryItemCriteria, context); // Display a description of each member of the summary object list StringBuilder summaryList = new StringBuilder(); foreach (InventoriedItemSummary a in inventoryItemSummaries) { summaryList.AppendLine("Inventory item description: " + a.Description); } 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 classIdRestriction; InventoriedItemCriteria inventoryItemCriteria; InventoriedItemSummary[] inventoryItemSummaries; // 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 the restriction object // Get items with an item class Id of 'ATT CORD' classIdRestriction = new LikeRestrictionOfstring(); classIdRestriction.EqualValue = "ATT CORD"; // Create the inventoried item criteria object inventoryItemCriteria = new InventoriedItemCriteria(); inventoryItemCriteria.ItemClassId = classIdRestriction; // Retrieve the list of inventoried item summary objects inventoryItemSummaries = wsDynamicsGP.GetInventoriedItemList(inventoryItemCriteria, context); // Display a description of each member of the summary object list StringBuilder summaryList = new StringBuilder(); foreach (InventoriedItemSummary a in inventoryItemSummaries) { summaryList.AppendLine("Inventory item description: " + a.Description); } MessageBox.Show(summaryList.ToString()); // Close the service if(wsDynamicsGP.State != CommunicationState.Faulted) { wsDynamicsGP.Close(); } } } }