using (SPLimitedWebPartManager webPartManager = web.GetLimitedWebPartManager(file.Url, PersonalizationScope.Shared))
{
ContentEditorWebPart wp = new ContentEditorWebPart();
XmlDocument xmlDoc = new XmlDocument();
XmlElement xmlElement = xmlDoc.CreateElement("Root");
xmlElement.InnerText = "Test CEWP Contents";
wp.Content = xmlElement;
wp.Content.InnerText = xmlElement.InnerText;
wp.Title = "Test";
webPartManager.AddWebPart(wp, "Zone 1", 10);
}
No comments:
Post a Comment