GetBackOfficeRoleByKey


Description

Retrieves a single back office security role based on the key value supplied.

Parameters

Parameter

Type

Description

backOfficeRoleKey

BackOfficeRoleKey

A back office role key object that specifies the back office security role to retrieve.

context

Context

Specifies information about how the method will be called.


Return Value:

Value

Type

Description

GetBackOfficeRoleByKeyResult

BackOfficeRole

A back office role object representing a security role defined in Microsoft Dynamics GP.


Interfaces

 

Examples

The following C# example retrieves the back office security role with the key value “BOOKKEEPER*”. The description of the security role 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)
		{
			OrganizationKey organizationKey;
			Context context;
			BackOfficeRole backOfficeRole;
			BackOfficeRoleKey backOfficeRoleKey;

			// 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;

			// Create the back office role key
			backOfficeRoleKey = new BackOfficeRoleKey();
			backOfficeRoleKey.Id = "BOOKKEEPER*";

			// Retrieve the back office role
			backOfficeRole = wsDynamicsGP.GetBackOfficeRoleByKey(backOfficeRoleKey, context);

			// Display the description of the back office security role
			MessageBox.Show(backOfficeRole.Description);
	}
}
}

 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 backOfficeRole;
			BackOfficeRoleKey backOfficeRoleKey;

			// 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;

			// Create the back office role key
			backOfficeRoleKey = new BackOfficeRoleKey();
			backOfficeRoleKey.Id = "BOOKKEEPER*";

			// Retrieve the back office role
			backOfficeRole = wsDynamicsGP.GetBackOfficeRoleByKey(backOfficeRoleKey, context);

			// Display the description of the back office security role
			MessageBox.Show(backOfficeRole.Description);

			// Close the service
			if(wsDynamicsGP.State != CommunicationState.Faulted)
			{
				wsDynamicsGP.Close();
		}
	}
}
}


Documentation Feedback