Hinweis
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, sich anzumelden oder das Verzeichnis zu wechseln.
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, das Verzeichnis zu wechseln.
Description
This method creates a new back office role assignment, assigning a Microsoft Dynamics GP user to a security role.
Parameters
Parameter |
Type |
Description |
|---|---|---|
backOfficeRoleAssignment |
The back office role assignment object being created. |
|
context |
Specifies information about how the method will be called. |
|
policy |
Specifies the set of behaviors and behavior options to be applied during the operation. |
Interfaces
- Dynamics GP
- Common
- Field Service
- Financials
- Human Resources/Payroll
- Inventory
- Manufacturing
- Project Accounting
- Purchasing
- Sales
Examples
The following C# example adds the user "STEVEK" to the "PAYROLL CLERK*" back office security role for the sample company in Microsoft Dynamics GP.
** 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;
CompanyKey companyKey;
BackOfficeRoleKey roleKey;
UserKey userKey;
BackOfficeRoleAssignment backOfficeRoleAssignment;
BackOfficeRoleAssignmentKey backOfficeRoleAssignmentKey;
Policy roleAssignmentCreatePolicy;
// Create an instance of the service
DynamicsGP wsDynamicsGP = new DynamicsGP();
// Be sure the default credentials are used
wsDynamicsGP.UseDefaultCredentials = true;
// Specify the assignment will be created in the sample company
companyKey = new CompanyKey();
companyKey.Id = (-1);
// Create a context with which to call the service
context = new Context();
// Set up the context object
context.OrganizationKey = (OrganizationKey)companyKey;
// Specify the role
roleKey = new BackOfficeRoleKey();
roleKey.Id = "PAYROLL CLERK*";
// Specify the user
userKey = new UserKey();
userKey.Id = "STEVEK";
// Create the backOfficeRoleAssignment and key
backOfficeRoleAssignment = new BackOfficeRoleAssignment();
backOfficeRoleAssignmentKey = new BackOfficeRoleAssignmentKey();
// Define back office role assignment
backOfficeRoleAssignmentKey.CompanyKey = companyKey;
backOfficeRoleAssignmentKey.RoleKey = roleKey;
backOfficeRoleAssignmentKey.UserKey = userKey;
backOfficeRoleAssignment.Key = backOfficeRoleAssignmentKey;
// Get the create policy for back office role assignment objects
roleAssignmentCreatePolicy = wsDynamicsGP.GetPolicyByOperation("CreateBackOfficeRoleAssignment",
context);
// Create the back office role assignment
wsDynamicsGP.CreateBackOfficeRoleAssignment(backOfficeRoleAssignment, context,
roleAssignmentCreatePolicy);
}
}
}
** 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;
CompanyKey companyKey;
BackOfficeRoleKey roleKey;
UserKey userKey;
BackOfficeRoleAssignment backOfficeRoleAssignment;
BackOfficeRoleAssignmentKey backOfficeRoleAssignmentKey;
Policy roleAssignmentCreatePolicy;
// Create an instance of the service
DynamicsGPClient wsDynamicsGP = new DynamicsGPClient();
// Specify the assignment will be created in the sample company
companyKey = new CompanyKey();
companyKey.Id = (-1);
// Create a context with which to call the service
context = new Context();
// Set up the context object
context.OrganizationKey = (OrganizationKey)companyKey;
// Specify the role
roleKey = new BackOfficeRoleKey();
roleKey.Id = "PAYROLL CLERK*";
// Specify the user
userKey = new UserKey();
userKey.Id = "STEVEK";
// Create the backOfficeRoleAssignment and key
backOfficeRoleAssignment = new BackOfficeRoleAssignment();
backOfficeRoleAssignmentKey = new BackOfficeRoleAssignmentKey();
// Define back office role assignment
backOfficeRoleAssignmentKey.CompanyKey = companyKey;
backOfficeRoleAssignmentKey.RoleKey = roleKey;
backOfficeRoleAssignmentKey.UserKey = userKey;
backOfficeRoleAssignment.Key = backOfficeRoleAssignmentKey;
// Get the create policy for back office role assignment objects
roleAssignmentCreatePolicy = wsDynamicsGP.GetPolicyByOperation("CreateBackOfficeRoleAssignment",
context);
// Create the back office role assignment
wsDynamicsGP.CreateBackOfficeRoleAssignment(backOfficeRoleAssignment, context,
roleAssignmentCreatePolicy);
// Close the service
if(wsDynamicsGP.State != CommunicationState.Faulted)
{
wsDynamicsGP.Close();
}
}
}
}