Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Description
Retrieves a list of item warehouse summary objects that meet the specified criteria.
Parameters
Parameter |
Type |
Description |
|---|---|---|
criteria |
The item warehouse criteria object that specifies which item warehouse summary objects to retrieve. |
|
context |
Specifies information about how the method will be called. |
Return Value:
Value |
Type |
Description |
|---|---|---|
GetItemWarehouseListResult |
A list of the item warehouse summary objects that match the specified criteria. |
Interfaces
- Dynamics GP
- Inventory
Examples
The following C# example retrieves the list of item warehouse summary objects with a warehouse key of "North" and an item key containing "SDRAM". A message box displays the item ID 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 itemCriteria;
LikeRestrictionOfString warehouseCriteria;
ItemWarehouseCriteria itemWarehouseCriteria;
ItemWarehouseSummary[] itemWarehouseSummaries;
// 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 items with a key which contains 'SDRAM'
itemCriteria = new LikeRestrictionOfString();
itemCriteria.Like = "%SDRAM%";
// Create a restriction object
// Retrieve only items from the warehouse with a key of 'North'
warehouseCriteria = new LikeRestrictionOfString();
warehouseCriteria.EqualValue = "North";
// Create an item warehouse criteria object
itemWarehouseCriteria = new ItemWarehouseCriteria();
itemWarehouseCriteria.ItemId = itemCriteria;
itemWarehouseCriteria.WarehouseId = warehouseCriteria;
// Retrieve the list if item warehouse summary objects
itemWarehouseSummaries = wsDynamicsGP.GetItemWarehouseList(itemWarehouseCriteria, context);
// Display the item ID of each member of the summary object list
StringBuilder summaryList = new StringBuilder();
foreach (ItemWarehouseSummary a in itemWarehouseSummaries)
{
summaryList.AppendLine("Item: " + a.Key.ItemKey.Id);
}
MessageBox.Show(summaryList.ToString());
}
}
}
** Native endpoint **
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
using System.Windows.Forms;
using DynamicsGPWebServiceSample.DynamicsGPService;
namespace DynamicsGPWebServiceSample
{
class Program
{
static void Main(string[] args)
{
CompanyKey companyKey;
Context context;
LikeRestrictionOfstring itemCriteria;
LikeRestrictionOfstring warehouseCriteria;
ItemWarehouseCriteria itemWarehouseCriteria;
ItemWarehouseSummary[] itemWarehouseSummaries;
// 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 items with a key which contains 'SDRAM'
itemCriteria = new LikeRestrictionOfstring();
itemCriteria.Like = "%SDRAM%";
// Create a restriction object
// Retrieve only items from the warehouse with a key of 'North'
warehouseCriteria = new LikeRestrictionOfstring();
warehouseCriteria.EqualValue = "North";
// Create an item warehouse criteria object
itemWarehouseCriteria = new ItemWarehouseCriteria();
itemWarehouseCriteria.ItemId = itemCriteria;
itemWarehouseCriteria.WarehouseId = warehouseCriteria;
// Retrieve the list if item warehouse summary objects
itemWarehouseSummaries = wsDynamicsGP.GetItemWarehouseList(itemWarehouseCriteria, context);
// Display the item ID of each member of the summary object list
StringBuilder summaryList = new StringBuilder();
foreach (ItemWarehouseSummary a in itemWarehouseSummaries)
{
summaryList.AppendLine("Item: " + a.Key.ItemKey.Id);
}
MessageBox.Show(summaryList.ToString());
// Close the service
if(wsDynamicsGP.State != CommunicationState.Faulted)
{
wsDynamicsGP.Close();
}
}
}
}