Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

ErrorWebPart

248 views
Skip to first unread message

kenj55

unread,
Nov 15, 2006, 5:42:16 AM11/15/06
to
Hi,

I'm having a problem accessing ContentEditorWebparts on a page through
C# code. My code is as follows:

SPLimitedWebPartManager webPartManager =
listItem.File.GetLimitedWebPartManager(PersonalizationScope.Shared);
SPLimitedWebPartCollection webParts= webPartManager.WebParts;
foreach (Microsoft.SharePoint.WebPartPages.WebPart webPart in webParts)
{
ContentEditorWebPart contentEditorWebPart = webPart as
ContentEditorWebPart;
if (contentEditorWebPart != null)
{
//doesn't get here
}
else
{
Console.WriteLine(webPart.GetType().FullName)
}
}

This code outputs 'Microsoft.SharePoint.WebPartPages.ErrorWebPart' each
time.
If I view the page using '?contents=1' all the WebParts are listed as
'ContentEditorWebPart'

I'm using MOSS 2007.

Anyone have any ideas what's going wrong?

Thanks,
Ken

niranj...@gmail.com

unread,
Mar 22, 2013, 2:10:26 AM3/22/13
to
0 new messages