DeleteBusinessObjectUserAssignment


Description

Deletes a business object user assignment.

Parameters

Parameter

Type

Description

businessObjectUserAssignment

BusinessObjectUserAssignment

The business object user assignment to be deleted.

context

Context

Specifies information about how the method will be called.


Interfaces

 

Examples

The following example deletes all of the business object user assignments for the Windows User ID “CORPORATE\stevek”.

 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;
			BusinessObjectUserAssignment[] businessObjectUserAssignments;

			// 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 business object user assignment objects
			businessObjectUserAssignments = wsDynamicsGP.GetBusinessObjectUserAssignmentList(context);

			// Delete the assignments for the specific Windows user
			foreach (BusinessObjectUserAssignment a in businessObjectUserAssignments)
			{
				if (a.User == "CORPORATE\\stevek")
				{
					// Delete this object
					wsDynamicsGP.DeleteBusinessObjectUserAssignment(a, context);
			}
		}
	}
}
}

 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)
		{
			Context context;
			BusinessObjectUserAssignment[] businessObjectUserAssignments;

			// 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 business object user assignment objects
			businessObjectUserAssignments = wsDynamicsGP.GetBusinessObjectUserAssignmentList(context);

			// Delete the assignments for the specific Windows user
			foreach (BusinessObjectUserAssignment a in businessObjectUserAssignments)
			{
				if (a.User == "CORPORATE\\stevek")
				{
					// Delete this object
					wsDynamicsGP.DeleteBusinessObjectUserAssignment(a, context);
			}
		}

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


Documentation Feedback