Home > SharePoint, webpart, wss > Read data programmatically from Content Editor Web part

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;
}
}
Advertisements
Categories: SharePoint, webpart, wss
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s

%d bloggers like this: