Export (0) Print
Expand All
Expand Minimize

ExportCompressedAllXml Message (CrmService)

banner art

[Applies to: Microsoft Dynamics CRM 4.0]

Works for all deployment typesWorks online only

Export all customizations to an XML file, which is then compressed by using the Zip format.

The relevant classes are specified in the following table.

TypeClass
RequestExportCompressedAllXmlRequest
ResponseExportCompressedAllXmlResponse

Remarks

To use this message, pass an instance of the ExportCompressedAllXmlRequest class as the request parameter in the Execute method.

For a list of required privileges, see ExportCompressedAllXml Privileges.

Example

The following code sample shows how to use the ExportCompressedAllXml message.

[C#]
// 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.
ExportCompressedAllXmlRequest request = new ExportCompressedAllXmlRequest();

// Assign the file name for the customizations.
request.EmbeddedFileName = "customizations.xml";

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

// Get the compressed data.
byte[] compressedXML = response.ExportCompressedXml;

// Write the data to disk.
using (FileStream fs = new FileStream(@"C:\Customizations.zip", FileMode.Create))
{

fs.Write(compressedXML, 0, compressedXML.Length);
fs.Close();

}
[Visual Basic .NET]
' Set up the CRM Service.
Dim token As 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";
 
Dim service As New CrmService()
service.Url = "http://<servername>:<port>/mscrmservices/2007/crmservice.asmx";
service.CrmAuthenticationTokenValue = token;
service.Credentials = System.Net.CredentialCache.DefaultCredentials

' Create the request.
Dim request As New ExportCompressedAllXmlRequest()

' Assign the file name for the customizations.
request.EmbeddedFileName = "customizations.xml"

' Execute the request.
Dim response As ExportCompressedAllXmlResponse = CType(service.Execute(request), ExportCompressedAllXmlResponse)

' Get the compressed data.
Dim compressedXML() As Byte = response.ExportCompressedXml

' Get the current directory path.
Dim currentDirectoryPath As String = System.IO.Directory.GetCurrentDirectory()

' Write it out to disk.
Using fs As New FileStream(currentDirectoryPath & "\Customizations.zip", FileMode.Create)

    fs.Write(compressedXML, 0, compressedXML.Length)
    fs.Close()

End Using

See Also

Concepts

Reference

See Also

Concepts

Reference


© 2010 Microsoft Corporation. All rights reserved.


Show:
© 2014 Microsoft