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 the policy summary objects for the current company.
Parameters
Parameter |
Type |
Description |
|---|---|---|
context |
Specifies information about how the method will be called. |
Return Value:
Value |
Type |
Description |
|---|---|---|
GetPolicyListResult |
The list of policy summary objects returned. |
Interfaces
- Dynamics GP
- Common
- Field Service
- Financials
- Human Resources/Payroll
- Inventory
- Manufacturing
- Project Accounting
- Purchasing
- Sales
Examples
The following C# example retrieves the list of policy summary objects for the policies defined in the sample company Fabrikam. The total number of policy summary objects 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;
PolicySummary[] policySummaryList;
// Create an instance of the service
DynamicsGP wsDynamicsGP = new DynamicsGP();
// Be sure that default credentials are being 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
context.OrganizationKey = (OrganizationKey)companyKey;
// Retrieve the list of policies
policySummaryList = wsDynamicsGP.GetPolicyList(context);
// Display the number of policy summary objects
MessageBox.Show("Total Policies: " + policySummaryList.Length.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;
PolicySummary[] policySummaryList;
// 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
context.OrganizationKey = (OrganizationKey)companyKey;
// Retrieve the list of policies
policySummaryList = wsDynamicsGP.GetPolicyList(context);
// Display the number of policy summary objects
MessageBox.Show("Total Policies: " + policySummaryList.Length.ToString());
// Close the service
if(wsDynamicsGP.State != CommunicationState.Faulted)
{
wsDynamicsGP.Close();
}
}
}
}