IOrganizationService.Execute(OrganizationRequest) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Executes a message in the form of a request, and returns a response.
public:
Microsoft::Xrm::Sdk::OrganizationResponse ^ Execute(Microsoft::Xrm::Sdk::OrganizationRequest ^ request);
[System.ServiceModel.FaultContract(typeof(Microsoft.Xrm.Sdk.OrganizationServiceFault))]
[System.ServiceModel.OperationContract]
public Microsoft.Xrm.Sdk.OrganizationResponse Execute (Microsoft.Xrm.Sdk.OrganizationRequest request);
[<System.ServiceModel.FaultContract(typeof(Microsoft.Xrm.Sdk.OrganizationServiceFault))>]
[<System.ServiceModel.OperationContract>]
abstract member Execute : Microsoft.Xrm.Sdk.OrganizationRequest -> Microsoft.Xrm.Sdk.OrganizationResponse
Public Function Execute (request As OrganizationRequest) As OrganizationResponse
Parameters
- request
- OrganizationRequest
Type: OrganizationRequest. A request instance that defines the action to be performed.
Returns
Type: OrganizationResponseThe response from the request. You must cast the return value of this method to the specific instance of the response that corresponds to the Request
parameter.
- Attributes
Examples
The following example shows how to use the Execute(OrganizationRequest) method to assign an account to a team (early bound). For this sample to work correctly, you must be connected to the server to get an IOrganizationService interface. You can find the complete sample in the sample code package in the folder SampleCode\CS\GeneralProgramming\EarlyBound\AssignRecordToTeam.cs
.
// Assign the account to a team.
AssignRequest assignRequest = new AssignRequest()
{
Assignee = new EntityReference
{
LogicalName = Team.EntityLogicalName,
Id = _teamId
},
Target = new EntityReference(Account.EntityLogicalName, _accountId)
};
_service.Execute(assignRequest);
The following example shows how to use the Execute(OrganizationRequest) method to assign a queue to a team (late bound). For this sample to work correctly, you must be connected to the server to get an IOrganizationService interface. You can find the complete sample in the sample code package in the folder SampleCode\CS\GeneralProgramming\LateBound\AssignQueueToTeamDE.cs
.
Remarks
Privileges and Access Rights
To execute the message, the caller must have the necessary privileges to the entity type that is specified in the request class. The caller must also have access rights on the specified records in the request class. For more information, see the Request
class for the action you want to execute. For example, see AssignRequest.
Notes for Callers
For more information about the exceptions that can be thrown when this method is called, see Handle exceptions in your code.
Method Availability
This method works regardless whether the caller is connected to the server or offline.