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

I have to migrate some content from text files from my storage to my SharePoint 2013.

The plan is to put the content into some content editor webparts at a basic page.

I know how to create the basic pages like items in my doclib via a console app, but how do i get the CEWP for adding some content to it?

share|improve this question

The following code snippet could help you. This can be achieved using SPLimitedWebPartManager. Pass your required page url to "pageURL" in the code below.

SPLimitedWebPartManager mgr = web.GetLimitedWebPartManager(pageURL, System.Web.UI.WebControls.WebParts.PersonalizationScope.Shared);
             XmlElement p = new XmlDocument().CreateElement("p");
             p.InnerText = "<b>Hello World</b>";
             ContentEditorWebPart editor = new ContentEditorWebPart(){ Content = p};
             mgr.AddWebPart(editor, "Header", 1);
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.