I am trying to use the Copy web service to add a document to my pages library. So far I have come up with the code below:
CopyService.FieldInformation fiPage = new CopyService.FieldInformation();
CopyService.FieldInformation[] fiPageArray = { new FieldInformation
{
InternalName = "Title",
Value = "NewTester.aspx",
DisplayName = "tester",
Type = FieldType.Text
}
};
CopyService.CopyResult pageRes = new CopyService.CopyResult();
CopyService.CopyResult[] pageResArray = {pageRes};
ceoCopy.CopyIntoItems("http://null", new string[] { pagesUrl + "Newtester.aspx" }, fiPageArray, Encoding.ASCII.GetBytes(baseContent), out pageResArray);
Which is actually creating the page that I want in my destination. My problem is that when I try to open this page I get the error:
This page is not using a valid page layout. To correct the problem, edit page settings and select a valid page layout."
When I checked, there was no page layout assigned to the new page so I tried changing my FieldInformation array to:
CopyService.FieldInformation[] fiPageArray = { new FieldInformation
{
InternalName = "Title",
Value = "NewTester.aspx",
DisplayName = "tester",
Type = FieldType.Text
} ,
new FieldInformation
{
InternalName = "PublishingPageLayout",
Value = "MNCStandardPage",
DisplayName = "PublishingPageLayout",
Type = FieldType.Text
}
};
But this is not fixing the issue. How can I set the Page Layout using the copy web service?