XmlDocument doc = new XmlDocument();
doc.LoadXml(nd.OuterXml); //GetWebPartProperties2 result set
XmlNamespaceManager nsmgr = new XmlNamespaceManager(doc.NameTable);
nsmgr.AddNamespace("wpp", "http://microsoft.com/sharepoint/webpartpages");
nsmgr.AddNamespace("wp", "http://schemas.microsoft.com/WebPart/v3");
XmlNode ndEmptyPartID = doc.SelectSingleNode(
"/wpp:WebParts/wpp:WebPart[" +
"wp:webPart/wp:metaData/wp:type/@name='" +
"Microsoft.SharePoint.WebPartPages.ErrorWebPart, Microsoft.SharePoint, Version=12.0.0.0," +
"Culture=neutral, PublicKeyToken=71e9bce111e9429c" +
"']/@ID",
nsmgr);
Guid WebPartID;
if (ndEmptyPartID != null)
{
WebPartID = new Guid(ndEmptyPartID.Value);
}
Thursday, July 12, 2007
Programatically Finding Error Web Parts on a Web Part Page
So, after your Sharepoint V2 to V3 migration your site collection is full of ErrorWebParts? Here is some XPATH that you can use when iterating through your site (while calling sharepoint web services) in order to find the the ErrorWebPart identifiers:
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment