Tell me more ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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?

share|improve this question

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.