Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Description
This method creates a new business object user assignment, assigning a Windows User ID to an ID in Microsoft Dynamics GP.
Parameters
Parameter |
Type |
Description |
|---|---|---|
businessObjectUserAssignment |
The business object user assignment object being created. |
|
context |
Specifies information about how the method will be called. |
Interfaces
- Dynamics GP
- Common
- Field Service
- Financials
- Human Resources/Payroll
- Inventory
- Manufacturing
- Project Accounting
- Purchasing
- Sales
Examples
The following C# example assigns the Windows User "CORPORATE\stevek" to the Back Office User "STEVEK" 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;
Guid BusinessObjectType = new Guid();
UserAssignableBusinessObject[] userAssignableBusinessObjects;
BusinessObjectUserAssignment businessObjectUserAssignment;
// 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;
// Retrieve the list of user-assignable business objects
userAssignableBusinessObjects = wsDynamicsGP.GetUserAssignableBusinessObjectList(context);
// Find the type for Back Office User
foreach (UserAssignableBusinessObject u in userAssignableBusinessObjects)
{
if (u.BusinessObjectTypeDisplayName == "Back Office User")
{
BusinessObjectType = u.BusinessObjectTypeId;
break;
}
}
// Define the business object user assignment
businessObjectUserAssignment = new BusinessObjectUserAssignment();
businessObjectUserAssignment.BusinessObjectKey = "STEVEK";
businessObjectUserAssignment.BusinessObjectTypeId = BusinessObjectType;
businessObjectUserAssignment.OrganizationKey = null; //Enterprise-level
businessObjectUserAssignment.User = "CORPORATE\\stevek";
// Create the business object user assignment
wsDynamicsGP.CreateBusinessObjectUserAssignment(businessObjectUserAssignment, context);
}
}
}
** 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;
Guid BusinessObjectType = new Guid();
UserAssignableBusinessObject[] userAssignableBusinessObjects;
BusinessObjectUserAssignment businessObjectUserAssignment;
// 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;
// Retrieve the list of user-assignable business objects
userAssignableBusinessObjects = wsDynamicsGP.GetUserAssignableBusinessObjectList(context);
// Find the type for Back Office User
foreach (UserAssignableBusinessObject u in userAssignableBusinessObjects)
{
if (u.BusinessObjectTypeDisplayName == "Back Office User")
{
BusinessObjectType = u.BusinessObjectTypeId;
break;
}
}
// Define the business object user assignment
businessObjectUserAssignment = new BusinessObjectUserAssignment();
businessObjectUserAssignment.BusinessObjectKey = "STEVEK";
businessObjectUserAssignment.BusinessObjectTypeId = BusinessObjectType;
businessObjectUserAssignment.OrganizationKey = null; //Enterprise-level
businessObjectUserAssignment.User = "CORPORATE\\stevek";
// Create the business object user assignment
wsDynamicsGP.CreateBusinessObjectUserAssignment(businessObjectUserAssignment, context);
// Close the service
if(wsDynamicsGP.State != CommunicationState.Faulted)
{
wsDynamicsGP.Close();
}
}
}
}