GetPolicyList

Description

Retrieves a list of the policy summary objects for the current company.

Parameters

Parameter

Type

Description

context

Context

Specifies information about how the method will be called.

Return Value:

Value

Type

Description

GetPolicyListResult

ArrayOfPolicySummary

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.

Cc508504.LegacyEndpoint(en-us,MSDN.10).gif** 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());
        }
    }
}

Cc508504.NativeEndpoint(en-us,MSDN.10).gif** 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();
            }
        }
    }
}