Copy Sharepoint pages from one sharepoint server/site to other

Few months ago , I had requirement of copy sharepoint 2007 pages to sharepoint 2013 site in my migration project.And this application is running out of sharepoint server so i have to use sharepoint services.I have used copy-service for this requirement.It will only copy static content of page not other webparts content.

So first fetch source page fieldinfo and bytearray using copy-service ‘GetItem’ method(add copy service reference and programatically change its url).


//give source copy-service url and credentials
CopyWS.Copy copyWS = new CopyWS.Copy();
copyWS.Url = "http://wssdev:7001/_vti_bin/copy.asmx";
copyWS.Credentials = new NetworkCredential("sourcesite-username", "sourcesite-password");

//fetch page fieldinfo and bytearray using copy GetItem method from source page.
CopyWS.FieldInformation[] mossPageFieldInfoArray;
byte[] mossPageByteArray;
uint myGetUint = copyWS.GetItem("http://wssdev:7001/Pages/test1.aspx", out mossPageFieldInfoArray, out mossPageByteArray);


Now set copy-service url to destination site and copy the page using ‘CopyIntoItems’ method.Pass source page fieldinfo and bytearray into this method.


//give destination copy-service url and credentials
copyWS = new CopyWS.Copy();
copyWS.Url = "http://spe2013dev1:4444/_vti_bin/copy.asmx";
copyWS.Credentials = new NetworkCredential("destinationsite-username", "destinationsite-password");

// create page in destination site using source page info.
CopyWS.CopyResult[] copyResultArray;
string[] copyDest = { "http://spe2013dev1:4444/Pages/test1.aspx" };
uint myCopyUint = copyWS.CopyIntoItems("http://wssdev:7001/Pages/test1.aspx", copyDest, mossPageFieldInfoArray, mossPageByteArray, out copyResultArray);


Check CopyResult.ErrorCode , if it is success then your page gets copied successfully else it will show error message.

Additional Information:

Page Field Information Array


Page Byte Array

Page Copy Result


Related link: