"缺少服务器端相关性"的内容定位

SharePoint 运行状况分析器已检测到一些值得关注的关键问题。其中一条为:

作为管理员,我如何能知道哪些地方用到了这个WebPart呢? Google搜索到2条很有用的途径。

1、通过stsadm来查找webpart的引用状况。

stsadm -o enumallwebs -includewebparts >c:\temp\somelog.txt

在返回的xml结果中,可以看到每个web下的webpart节点。

<Databases>
  <Database 。。。>
    <Site Id="76754f86-f517-4d46-8331-58378678401f" 。。。>
      <Webs Count="50">
        <Web Id="ef027756-f112-4765-a5b8-d5a13c1b7417" Url="/" LanguageId="2052" TemplateName="STS#0" TemplateId="1">
          <WebParts>
            <WebPart Id="baf5274e-a800-8dc3-96d0-0003d9405663" Count="20" Status="Missing SafeControls entry" Type="Microsoft.SharePoint.WebPartPages.ListViewWebPart" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" />
            <WebPart 。。。。
          </WebParts>
        </Web>
。。。

从中就可以找到一些错误的原因。即使出现在藏的很深的一个子网站里,都可以找到。

2、直接通过数据库来查找。用来检查错误的timerjob实际上在对应的内容数据库上运行了一个这样的查询:

SELECT tp_WebPartTypeId, COUNT(1), tp_Assembly, tp_Class
FROM AllWebParts (NOLOCK)
WHERE tp_WebPartTypeId IS NOT NULL GROUP BY tp_WebPartTypeId, tp_Assembly, tp_Class

通过错误信息提供给我们的WebPartTypeId,进行如下的查询:

SELECT *
FROM AllWebParts
WHERE tp_WebPartTypeId = 'b82a8e9d-8706-3252-0a3b-ba19bf65e250'

 结果中,找到了我要的SiteId。

该表还有一些其他的信息,可供我们排错。常用的几个表以及关系如下:

SELECT Webs.FullUrl, Webs.Title, AllDocs.DirName, AllDocs.LeafName

FROM AllDocs, Sites, AllWebParts, Webs

WHERE Webs.Id = Sites.RootWebId AND AllDocs.Id = AllWebParts.tp_PageUrlID

 AND Sites.Id = AllDocs.SiteId

 

参考资料

Missing Server Side Dependencies - 8d6034c4-a416-e535-281a-6b714894e1aa

How to find missing web part?

posted @ 2012-05-04 01:14  Sunmoonfire  阅读(1180)  评论(4编辑  收藏  举报