SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is it at all possible to make changes to or add a content editor to a page using only the Client Object Model API? There does not appear to be any reference to a ContentEditorWebPart dll.

share|improve this question
up vote 1 down vote accepted

You can't use the DLL as usual, you need to provide a Microsoft.SharePoint.Client.WebParts.WebPart, you can get this from WebPartDefinition which you again can get from LimitedWebPartManager.
Then you provide the correct definition, you can get this from exporting the Web Part.
You basically need <Assembly>Microsoft.SharePoint, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c</Assembly> and <TypeName>Microsoft.SharePoint.WebPartPages.ContentEditorWebPart</TypeName>.


var ctx = new ClientContext("http://localhost");
var page = ctx.Web.GetFileByServerRelativeUrl("/default.aspx");
var wpm = page.GetLimitedWebPartManager(PersonalizationScope.Shared);
var webPartDefinition = wpm.ImportWebPart(@"
  <?xml version='1.0' encoding='utf-8'?>
  <WebPart xmlns=''>
    <Title>Hello, Robert</Title>
    <Assembly>Microsoft.SharePoint, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c</Assembly>
    <Content><![CDATA[<strong>The Wheel weaves as the Wheel wills</strong>]]></Content>
wpm.AddWebPart(webPartDefinition.WebPart, "Main", 0);
share|improve this answer

Your Answer


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.