Saturday, November 20, 2010

PublishXml Message (CrmService)

Publish the customizations for the specified entities.
The relevant classes are: 1) PublishXmlRequest 2) PublishXmlResponse
To use this message, pass an instance of the PublishXmlRequest class as the request parameter in the Execute method.
For a list of required privileges, see PublishXml Privileges.
The following code example shows how to use the PublishXml message.
// Set up the CRM service.
CrmAuthenticationToken token = new CrmAuthenticationToken();
// You can use enums.cs from the SDK\Helpers folder to get the enumeration for Active Directory authentication.
token.AuthenticationType = 0;
token.OrganizationName = "AdventureWorksCycle";

CrmService service = new CrmService();
service.Url = "http://<servername>:<port>/mscrmservices/2007/crmservice.asmx";
service.CrmAuthenticationTokenValue = token;
service.Credentials = System.Net.CredentialCache.DefaultCredentials;

// Create the request.
PublishXmlRequest request = new PublishXmlRequest();

request.ParameterXml = @"<importexportxml>

// Execute the request.
PublishXmlResponse response = (PublishXmlResponse)service.Execute(request);

No comments: