共用方式為


IOrganizationServiceFactory.CreateOrganizationService Method

Definition

Returns an IOrganizationService instance for the organization that the specified user is a member of.

public:
 Microsoft::Xrm::Sdk::IOrganizationService ^ CreateOrganizationService(Nullable<Guid> userId);
public Microsoft.Xrm.Sdk.IOrganizationService CreateOrganizationService (Guid? userId);
abstract member CreateOrganizationService : Nullable<Guid> -> Microsoft.Xrm.Sdk.IOrganizationService
Public Function CreateOrganizationService (userId As Nullable(Of Guid)) As IOrganizationService

Parameters

userId
Nullable<Guid>

Specifies the system user that calls to the service are made for.

When called in a plug-in, a null value indicates the SYSTEM user and a Guid.Empty value indicates the same user as IPluginExecutionContext. UserId. Any other value indicates a specific system user.

When called in a custom workflow activity, all service calls are made in the IWorkflowExecutionContext.UserId context.

Returns

An organization service factory object.

Applies to