0

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?

0

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);
             spWebTest.Update();
|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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