La seguente query T-SQL per SharePoint 2003 permette di ripristinare la vista Explorer View precedentemente cancellata .
Prima di eseguirla assicurarsi di essere sul corretto DB (di default inizia con STS_....).
Agisce direttamente sul DB di SharePoint, prestare molta attenzione.
T-SQL
/*
 * 24-01-2007 Ripristina la vista Explorer View
 * in SharePoint 2003
 * ATTENZIONE: agisce direttamente sul DB
 */ 
-- POSIZIONARSI SUL DB DI SHARE POINT
DECLARE @viewId uniqueidentifier
DECLARE @listId uniqueidentifier
DECLARE @tp_WebPartTypeId uniqueidentifier
SET @viewId = newid()

/*
 * INSERIRE QUI IL GUID DELLA LISTA DA MODIFICARE
 * es: http://sp.local/_layouts/1033/listedit.aspx?List={2CB36B3A-F75A-48C3-A5DC-A0D51E13879F}
 */
SET @listId = '{2CB36B3A-F75A-48C3-A5DC-A0D51E13879F}'

IF @listId is not  null
BEGIN
	-- seleziona una vista qualsiasi con xxx/Forms
	-- e la copia con i valori corretti
	INSERT INTO [Docs]([Id], [SiteId], [DirName], [LeafName], [WebId], [ListId], [DoclibRowId],
		[Type], [Size], [MetaInfoSize], [Version], [UIVersion],
		[Dirty], [CacheParseId], [DocFlags], [ThicketFlag],
		[CharSet], [TimeCreated], [TimeLastModified],
		[NextToLastTimeModified], [MetaInfoTimeLastModified],
		[TimeLastWritten],
		[SetupPath],
		[CheckoutUserId], [CheckoutDate], [CheckoutExpires],
		[CheckoutSize], [VersionCreatedSinceSTCheckout],
		[VirusVendorID], [VirusStatus],
		[VirusInfo], [MetaInfo], [Content],
		[CheckoutContent])
	SELECT TOP 1 @viewId AS Id, SiteId, DirName, 'WebFldr.aspx' AS LeafName, WebId, ListId, null AS DoclibRowId, 
		0 AS Type, 6746 AS [Size], null AS MetaInfoSize, 1 AS Version, 1 AS UIVersion,
		0 AS Dirty, null AS CacheParseId, 12 AS DocFlags, 0 AS ThicketFlag, 
	        null AS CharSet, getdate() AS TimeCreated, getdate() AS TimeLastModified,
		null AS NextToLastTimeModified, getdate() AS MetaInfoTimeLastModified,
		getdate() AS TimeLastWritten, 
		'1033\STS\Lists\doclib\WebFldr.aspx' AS SetupPath, 
		null AS CheckoutUserId, null AS CheckoutDate, null AS CheckoutExpires,
		null AS CheckoutSize, 0 AS VersionCreatedSinceSTCheckout, 
		null AS VirusVendorID, null AS VirusStatus,
		null AS VirusInfo, null AS MetaInfo, null AS Content,
		null AS CheckoutContent
	FROM         Docs
	WHERE [ListId] = @listId and [DirName] like '%/Forms' --and leafName = 'DispForm.aspx'

	-- recupera tp_WebPartTypeId
	-- [tp_WebPartTypeId] ?!?!? molto probabilmente il guid della dll che gestisce l'explorer view
	SELECT TOP 1  @tp_WebPartTypeId = tp_WebPartTypeId
	FROM WebParts
	WHERE (tp_DisplayName = 'Explorer View') AND (tp_BaseViewID = 3)

	-- a questo punto inserisco un riferimento alla lista anche nella WebParts
	-- http://msdn2.microsoft.com/en-us/library/ms998719.aspx
	INSERT INTO [WebParts]([tp_SiteId], [tp_ID], [tp_ListId], [tp_Type], [tp_Flags],
		[tp_BaseViewID], [tp_DisplayName], [tp_Version],
		[tp_PageUrlID], [tp_PartOrder], [tp_ZoneID],
		[tp_IsIncluded], [tp_FrameState], [tp_View],
		[tp_WebPartTypeId],
		[tp_AllUsersProperties], [tp_PerUserProperties],
		[tp_Cache], [tp_UserID], [tp_Source],
		[tp_CreationTime], [tp_Size])
	SELECT top 1 [tp_SiteId], newid() AS [tp_ID], [tp_ListId], 1 as [tp_Type], 33 as [tp_Flags],
		3 AS [tp_BaseViewID], 'Explorer View' AS [tp_DisplayName], 1 AS [tp_Version],
		@viewId AS [tp_PageUrlID], 1 AS [tp_PartOrder], 'Main' AS [tp_ZoneID],
		1 AS [tp_IsIncluded], 0 AS [tp_FrameState], null AS [tp_View],
		@tp_WebPartTypeId AS [tp_WebPartTypeId],
		null AS [tp_AllUsersProperties], null AS [tp_PerUserProperties],
		null AS [tp_Cache], null AS [tp_UserID], null AS [tp_Source],
		getdate() AS [tp_CreationTime], 116 AS [tp_Size]
	FROM [WebParts]
	WHERE [tp_ListId] = @listId
END
Se si utilizza SharePoint in italiano sostituire il percorso '1033\STS\Lists\doclib\WebFldr.aspx' con '1040\STS\Lists\doclib\WebFldr.aspx'

Per recuperare il guid della lista si può usare anche la seguente query T-SQL
T-SQL
-- da eseguire per trovare il guid 
-- tramite il nome della DocLib
DECLARE @listId uniqueidentifier
DECLARE @library nvarchar(255)
SET @library = 'vx' -- nome della lista

SELECT @listId = [tp_ID]
FROM [Lists]
WHERE [tp_Title] = @library

SELECT [tp_ID], [tp_Title], *
FROM [Lists]
WHERE [tp_ID] = @listId
Potrebbe interessarti anche: