以下を検討してください。
すべてのリストとドキュメント ライブラリを含む管理者サブ サイトがあり、XlstViewWebPart を使用してルート Web のほとんどのドキュメント ライブラリをプログラムでプロビジョニングし、アイテムを選択してリボンの削除ボタンを使用して削除しようとすると、次のようになります。
サーバーで次のエラーが発生しました: リストが存在しません。選択したページには、存在しないリストが含まれています。別のユーザーによって削除された可能性があります。
しかし、アイテムポップアップメニューからアイテムを削除すると、正常に機能して削除されます!!!!
プラットフォーム: SharePoint Server 2010 SP1、VS 2010、CU 2012 年 6 月
前もって感謝します
========================================
更新 (Web パーツをプロビジョニングするためのマイ コード)
Dim _web As SPWeb = SPContext.Current.Site.RootWeb
Try
'Get refrence to publishing web
Dim _pubWeb As PublishingWeb = PublishingWeb.GetPublishingWeb(_web)
Dim WPM As Microsoft.SharePoint.WebPartPages.SPLimitedWebPartManager
If _pubWeb IsNot Nothing Then
'Loop each publishing page in the web
'Check out the file
'If the current page have CustomWebPart (It is an Custom System Page), Then
'If XsltListViewWebPart is not provisiond (double check in case of click the button more than one time), then
'Create an XsltListViewWebPart
'Assign properties of the new XsltListViewWebPart with Document Lib. Name and Admin web
'Add the new XsltListViewWebPart to the current page in the loop
For Each curPage As PublishingPage In _pubWeb.GetPublishingPages()
If curPage.ListItem.File.RequiresCheckout AndAlso curPage.ListItem.File.CheckOutType = SPFile.SPCheckOutType.None Then curPage.CheckOut()
WPM = curPage.ListItem.File.GetLimitedWebPartManager(System.Web.UI.WebControls.WebParts.PersonalizationScope.Shared)
Dim CustomWebPart As CustomWebPart = WPM.WebParts.OfType(Of CustomWebPart)().FirstOrDefault()
If CustomWebPart IsNot Nothing Then
If CustomWebPart.DocLibName.ToLower = Constants.List.MeetingSchedular.ListName.ToLower Then Continue For
Dim web As SPWeb = _web.Site.RootWeb.Webs(Constants.WebNames.AdminWeb) 'Get Admin Web
Dim LVWP As WebPartPages.XsltListViewWebPart = WPM.WebParts.OfType(Of WebPartPages.XsltListViewWebPart)().FirstOrDefault()
If LVWP Is Nothing Then
LVWP = New WebPartPages.XsltListViewWebPart
Dim lst As SPList = web.Lists(CustomWebPart.DocLibName)
With LVWP
.WebId = web.ID
.ViewGuid = lst.DefaultView.ID.ToString("B").ToUpper()
.ListName = lst.ID.ToString("B").ToUpper()
.ListId = lst.ID
.ListUrl = "/Admin/" + CustomWebPart.DocLibName
.TitleUrl = "/Admin/" + CustomWebPart.DocLibName
.ChromeType = System.Web.UI.WebControls.WebParts.PartChromeType.None
.AllowClose = False
.AllowEdit = True
.AllowMinimize = True
.AllowConnect = True
End With
_web.AllowUnsafeUpdates = True
WPM.AddWebPart(LVWP, "MainZone", 0)
curPage.Update()
_web.AllowUnsafeUpdates = False
End If
curPage.CheckIn("By cmdProvisionWebParts_Click")
curPage.ListItem.File.Publish("By cmdProvisionWebParts_Click")
End If
Next
End If
RegisterNotification("Provision Web Parts Completed successfully")
Catch ex As Exception
SiteHelper.WriteErrors("Custom_Settings.ProvisioningRootWebParts", ex)
RegisterNotification("Error: " + ex.Message)
End Try