Due query T-SQL che possono tornare utili per cercare dei documenti direttamente sul database di SharePoint 2016

Ad esempio, questa serve per cercare tutti i file di Reporting Services (.rdl) e le relative connessioni (.rsds)

T-SQL: Cerca pagine

SELECT TOP (1000) AD.[Id]
	  ,S.FullUrl
      ,[DirName]
      ,[LeafName]
      ,[DoclibRowId]
      ,[Size]
      ,AD.[TimeCreated]
      ,[TimeLastModified]
      ,[TimeLastWritten]
      ,[CheckoutUserId]
      ,[CheckoutDate]
      ,[IsCurrentVersion]
      ,[Level]
      ,[UIVersionString]
      ,[HasStream]
  FROM [dbo].[AllDocs] AD with(nolock)
	inner join [dbo].[AllSites] S with(nolock) on AD.SiteId = S.id
  where LeafName like '%.rsds' or LeafName like '%.rdl'
mentre questa torna utile per trovare deve sono determinate WebPart escludendo quelle native (il cui nome assembly inizia per Microsoft)

T-SQL: Cerca WebParts

SELECT TOP (1000) [tp_ID]
      ,[tp_PageUrlID]
      ,[tp_WebPartIdProperty]
      ,[tp_IsCurrentVersion]
	  , S.FullUrl as SiteUrl
	  ,web.FullUrl AS WebUrl
	  ,D.DirName AS DirUlr
	  ,D.LeafName AS FileName
      ,[tp_Class] 
  FROM [dbo].[AllWebParts] W with(nolock)
	inner join [dbo].[AllSites] S with(nolock) on W.tp_SiteId = S.id
	inner join [dbo].[AllDocs] D with(nolock) on w.tp_PageUrlID = d.Id
	inner join [dbo].[AllWebs] WEB with(nolock) on D.webid = WEB.id
  where
	tp_IsCurrentVersion = 1
	and tp_Assembly is not null 
	and tp_Assembly not like 'Microsoft%' 
	order by tp_Class
Attenzione se nella farm ci sono più site collection su più database, la query va ripetuta su ogni DB.
Tags:
Reporting Services18 SharePoint497 SharePoint 201667
Potrebbe interessarti anche: