The Execute method executes a message that represents either a specialized method or specific business logic.
Syntax
public Response Execute(
Request Request
);
Parameters
Request
Specifies a specific Request instance.
Return Value
Returns an instance of a Response. You must cast the return value of the Execute method to the specific instance of the response that corresponds to the Request parameter.
Remarks
To perform this action, the caller must have the necessary privileges to the entity type specified in the request class. The caller must also have access rights on the entity instances specified in the request class.
Example
The following example demonstrates the use of the Execute method.
1: //# [CrmService.Execute Method]
2: // Set up the CRM Service.
3: CrmAuthenticationToken token = new CrmAuthenticationToken();
4: // You can use enums.cs from the SDK\Helpers folder to get the enumeration for Active Directory authentication.
5: token.AuthenticationType = 0;
6: token.OrganizationName = "AdventureWorksCycle";
7:
8: CrmService service = new CrmService();
9: service.Url = "http://<servername>:<port>/mscrmservices/2007/crmservice.asmx";
10: service.CrmAuthenticationTokenValue = token;
11: service.Credentials = System.Net.CredentialCache.DefaultCredentials;
12:
13: // Create the request object.
14: AddItemCampaignRequest add = new AddItemCampaignRequest();
15:
16: // Set the properties of the request object.
17: add.CampaignId = campaignId;
18: add.EntityId = productId;
19: add.EntityName = EntityName.product;
20:
21: // Execute the request.
22: AddItemCampaignResponse added = (AddItemCampaignResponse) service.Execute(add);