Retrieves a list of the policy summary objects for the current company.
Parameter |
Type |
Description |
---|---|---|
context |
Specifies information about how the method will be called. |
Value |
Type |
Description |
---|---|---|
GetPolicyListResult |
The list of policy summary objects returned. |
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.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(); } } } }