Description
Retrieves the list of company objects for companies in Microsoft Dynamics GP that have had web services installed.
Parameters
Parameter |
Type |
Description |
|---|---|---|
context |
Specifies information about how the method will be called. |
Return Value:
Value |
Type |
Description |
|---|---|---|
GetWSEnabledCompanyListResult |
The collection of company objects for which web services have been installed. |
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 all companies in Microsoft Dynamics GP that have had web services installed.
** 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)
{
Context context;
Company[] companies;
// 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();
// Set up the context object
context.OrganizationKey = null;
// Retieve the list of companies enabled for web services
companies = wsDynamicsGP.GetWSEnabledCompanyList(context);
// Display the list of companies
StringBuilder companyList = new StringBuilder();
foreach (Company c in companies)
{
companyList.AppendLine(c.Name);
}
MessageBox.Show(companyList.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)
{
Context context;
Company[] companies;
// Create an instance of the service
DynamicsGPClient wsDynamicsGP = new DynamicsGPClient();
// Create a context with which to call the service
context = new Context();
// Set up the context object
context.OrganizationKey = null;
// Retieve the list of companies enabled for web services
companies = wsDynamicsGP.GetWSEnabledCompanyList(context);
// Display the list of companies
StringBuilder companyList = new StringBuilder();
foreach (Company c in companies)
{
companyList.AppendLine(c.Name);
}
MessageBox.Show(companyList.ToString());
// Close the service
if(wsDynamicsGP.State != CommunicationState.Faulted)
{
wsDynamicsGP.Close();
}
}
}
}