PublishingService.ExportObjects Method

Use this Web service to export current Major or Minor version of the PublishingPages in the PublishingWeb that participates in variations.

Namespace:  Microsoft.SharePoint.Publishing.WebServices
Assembly:  Microsoft.SharePoint.Publishing (in Microsoft.SharePoint.Publishing.dll)

Syntax

'Declaration
<WebMethodAttribute> _
Public Function ExportObjects ( _
    webUrl As String _
) As Byte()
'Usage
Dim instance As PublishingService
Dim webUrl As String
Dim returnValue As Byte()

returnValue = instance.ExportObjects(webUrl)
[WebMethodAttribute]
public byte[] ExportObjects(
    string webUrl
)

Parameters

  • webUrl
    Type: System.String

    Absolute URL of the PublishingWeb object for which pages are to be exported.

Return Value

Type: []
Stream of bytes from a compressed .cmp file.

Remarks

The Web service is provided to export variation pages for translation. Given a PublishingWeb, we extract all pages in the site that participate in variations and export the content of those pages. The returned stream belongs to the compressed file that contains all data related to these pages. Content is translated in the manifest.xml file in the compressed .cmp file. Use the ImportObjects() Web service to reimport the translated pages to the Variation site. To export a PublishingWeb you must be the Web site Administrator and you must have permissions to view page dependencies.

Examples

using System;
using System.IO;
using System.Collections.Generic;
using System.Text;
using System.Net;
//Replace macro with "(your assembly name).(name of your Web reference)"
using PublishingServiceClient = Microsoft.SDK.SharePoint.Server.Samples.PublishingServiceClient;

namespace Microsoft.SDK.SharePoint.Server.Samples
{
    class Program
    {
        static void Main(string[] args)
        {        
            // Create a Web reference (named "PublishingServiceClient" here)which generates a SOAP Client class of the same name.
            // URL to the Web service is given by "http://servername/site/_vti_bin/PublishingService.asmx" 
            // Access the Web service methods using objects of this class.
            PublishingServiceClient.PublishingService publishingServiceClient = new PublishingServiceClient.PublishingService();

            //Create credentials for the user accessing the Web service. The export requires site administrator privileges.
            //Use default credentials if the user running client has required rights at the server.
            //Otherwise, explicitly create Credentials using new System.Net.Credentials("username","passwd", "domain").
            publishingServiceClient.Credentials = System.Net.CredentialCache.DefaultCredentials;

            //Replace webUrl with the url of the site you want to export.
            string webUrl = "http://servername/Variation Home/Variation Site";

            if (!string.IsNullOrEmpty(webUrl))
            {
                //Invoke the SOAP Client Method.
                byte[] compressedFileContent = publishingServiceClient.ExportObjects(webUrl);
                File.WriteAllBytes(Path.GetTempFileName(), compressedFileContent);
                //Uncompress the file for translation.
            }            
        ...

See Also

Reference

PublishingService Class

PublishingService Members

Microsoft.SharePoint.Publishing.WebServices Namespace

PublishingWeb

PublishingPage

SPExport

VariationPageUrl()

Variations

PublishingService