Read data programmatically from Content Editor Web part

using (SPSite site = new SPSite(""))
{
using (SPWeb web = site.OpenWeb())
{
SPFile file = web.GetFile("default.aspx");   
SPLimitedWebPartManager lwpm = file.GetLimitedWebPartManager(PersonalizationScope.Shared);                                   SPLimitedWebPartCollection webParts = lwpm.WebParts;
System.Web.UI.WebControls.WebParts.WebPart wp = webParts[1];                    
string content = (((Microsoft.SharePoint.WebPartPages.ContentEditorWebPart)(wp)).Content).InnerText;                
}  
}

Related Post

2 thoughts on “Read data programmatically from Content Editor Web part”

Leave a Reply

Your email address will not be published. Required fields are marked *