Retrieves a list of all of the back office role objects representing each security role defined in Microsoft Dynamics GP.
Parameter |
Type |
Description |
---|---|---|
context |
Specifies information about how the method will be called. |
Value |
Type |
Description |
---|---|---|
GetBackOfficeRoleListResult |
A list of back office role objects representing each security role defined in Microsoft Dynamics GP. |
The following C# example retrieves the list of all security roles defined in Microsoft Dynamics GP and displays their names 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) { OrganizationKey organizationKey; Context context; BackOfficeRole[] backOfficeRoles; // 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 the system database organizationKey = null; // Set up the context object context.OrganizationKey = organizationKey; // Retrieve the list of back office roles backOfficeRoles = wsDynamicsGP.GetBackOfficeRoleList(context); // Display the name of each security role in the list StringBuilder roleList = new StringBuilder(); foreach (BackOfficeRole a in backOfficeRoles) { roleList.AppendLine(a.Name); } MessageBox.Show(roleList.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) { OrganizationKey organizationKey; Context context; BackOfficeRole[] backOfficeRoles; // Create an instance of the service DynamicsGPClient wsDynamicsGP = new DynamicsGPClient(); // Create a context with which to call the service context = new Context(); // Specify the system database organizationKey = null; // Set up the context object context.OrganizationKey = organizationKey; // Retrieve the list of back office roles backOfficeRoles = wsDynamicsGP.GetBackOfficeRoleList(context); // Display the name of each security role in the list StringBuilder roleList = new StringBuilder(); foreach (BackOfficeRole a in backOfficeRoles) { roleList.AppendLine(a.Name); } MessageBox.Show(roleList.ToString()); // Close the service if(wsDynamicsGP.State != CommunicationState.Faulted) { wsDynamicsGP.Close(); } } } }