Compartilhar via


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

  • Dynamics GP
  • Common
  • Field Service
  • Financials
  • Human Resources/Payroll
  • Inventory
  • Manufacturing
  • Project Accounting
  • Purchasing
  • Sales

Examples

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

Cc508680.LegacyEndpoint(en-us,MSDN.10).gif** 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);
                }
            }
        }
    }
}

Cc508680.NativeEndpoint(en-us,MSDN.10).gif** 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;
            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();
            }
        }
    }
}