Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Is it possible to get the content of a content webpart by using the client object model of SharePoint?

The usage scenario: I want to copy a site page (with content in content editor webparts) from one Sharepoint site to anonther site. That is why I use the client object model. Everything works fine, he copies the page to the other site; but when you open the aspx page in a browser, it is empty. Reason: because the content is in the database and not in the page.

EDIT: If someone knows how to export the page with the content in it; you may let me know also. If you export the aspx page with SharePoint Designer, you can get also the content of the content webparts in it. And if i am not wrong, SharePoint Designer also uses the Client Object Model.

share|improve this question
    
To do what exactly, please clarify. –  PirateEric Jun 19 '12 at 14:11
    
I want to copy a site page (with content in content editor webparts) from one sharepoint site (can be on premise or office 365) to anonther site (can also be on premise or office 365). That is why I use the client object model. Everything works fine, he copies the page to the other site; but when you open the aspx page in a browser, it is empty. Reason: because the content is in the database and not in the page... –  Davy Jun 19 '12 at 14:16
    
I've edited your post to include that. –  PirateEric Jun 19 '12 at 14:19
add comment

1 Answer 1

For the ContentEditorWebPart, the HTML content is actually an XmlElement called Content.

I found this post: http://blogs.technet.com/b/speschka/archive/2009/11/01/using-the-sharepoint-2010-client-object-model-part-6.aspx

Which talks about how to get webparts using the Client Object Model. Hopefully it can help you get going in the right direction.

EDIT:

I'm not sure that SP Designer exclusively uses the client object model. Using fiddler while editing a page in SP Designer, it seems that it is calling /_vti_bin/webpartpages.asmx and that web service is returning the html of the page including the properties of the webparts in xml format.

share|improve this answer
    
Thanks, but I already explored the LimitedWebPartManager and WebPartDefinition, but you can add new WebParts and check which webparts are on your page. But it is not possible to extract the content of the webpart. I am still wondering how Microsoft did it with SharePoint Designer. –  Davy Jun 19 '12 at 15:08
    
I've updated my answer above with some new information about SP Designer. –  Steve Lineberry Jun 19 '12 at 17:08
add comment

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.