Hinweis
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, sich anzumelden oder das Verzeichnis zu wechseln.
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, das Verzeichnis zu wechseln.
Description
Retrieves a list of service objects that match the specified criteria.
Parameters
Parameter |
Type |
Description |
|---|---|---|
criteria |
A service criteria object that specifies which service summary objects are returned. |
|
context |
Specifies information about how the method will be called. |
Return Value:
Value |
Type |
Description |
|---|---|---|
GetServiceListResult |
The list of service summary objects that match the specified criteria. |
Interfaces
- Dynamics GP
- Inventory
Examples
The following C# example retrieves the list of service summary objects with a generic description property of "Labor". The Id and Description properties from each service summary object 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;
LikeRestrictionOfString serviceRestriction;
ServiceCriteria serviceCriteria;
ServiceSummary[] serviceSummary;
// 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
serviceRestriction = new LikeRestrictionOfString();
serviceRestriction.Like = "Labor";
// Create a service criteria object
// Retrieve service summaries with a generic description property of Labor
serviceCriteria = new ServiceCriteria();
serviceCriteria.GenericDescription = serviceRestriction;
// Retrieve the service summaries specified by the criteria object
serviceSummary = wsDynamicsGP.GetServiceList(serviceCriteria, context);
// Display the ID and Description properties of each member of the object list
StringBuilder summaryList = new StringBuilder();
foreach (ServiceSummary a in serviceSummary)
{
summaryList.AppendLine("Service: " + a.Key.Id + " - " + a.Description);
}
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 serviceRestriction;
ServiceCriteria serviceCriteria;
ServiceSummary[] serviceSummary;
// 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
serviceRestriction = new LikeRestrictionOfstring();
serviceRestriction.Like = "Labor";
// Create a service criteria object
// Retrieve service summaries with a generic description property of Labor
serviceCriteria = new ServiceCriteria();
serviceCriteria.GenericDescription = serviceRestriction;
// Retrieve the service summaries specified by the criteria object
serviceSummary = wsDynamicsGP.GetServiceList(serviceCriteria, context);
// Display the ID and Description properties of each member of the object list
StringBuilder summaryList = new StringBuilder();
foreach (ServiceSummary a in serviceSummary)
{
summaryList.AppendLine("Service: " + a.Key.Id + " - " + a.Description);
}
MessageBox.Show(summaryList.ToString());
// Close the service
if(wsDynamicsGP.State != CommunicationState.Faulted)
{
wsDynamicsGP.Close();
}
}
}
}