Question: 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.

Answer: 
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.
If this helps someone,

```
using(ClientContext ctx = new ClientContext("siteURL")) {  
  SecureString password = new SecureString();
  ctx.Credentials = new SharePointOnlineCredentials("onlineEmail", password);
  File file = ctx.Web.GetFileByServerRelativeUrl("/pages/default.aspx");
  LimitedWebPartManager wpManager = file.GetLimitedWebPartManager(PersonalizationScope.Shared);
  Guid wpID= new Guid("{GUID}");
  ClientResult<string> wpXml= wpManager.ExportWebPart(wpID);
  ctx.ExecuteQuery();

  //Parse wpXml.Value to get Content Element
}

```

You can get WebPartID "GUID" from following code

```
var webParts = wpManager.WebParts; 
ctx.Load(webParts, wp => wp.Include(w => w.Id)); 
ctx.ExecuteQuery(); 
foreach (var wp in webParts) { Guid guid = new Guid(wp.Id ); } 

```