Это взято из SharePoint 2013:
USE [WSS_Content_Intranet]
GO
SELECT
(ISNULL(DocSizes,0) + ISNULL(UserDataSize,0)) As TotalSize,
nLists.tp_ID,
nLists.tp_Title,
nLists.tp_ItemCount,
Webs.FullUrl
FROM
Webs
INNER JOIN
(
SELECT
ALAux.ItemCount as tp_ItemCount,
Lists.tp_Title,
Lists.tp_ID,
Lists.tp_WebID,
ALAux.Modified as tp_Modified,
Lists.tp_ServerTemplate,
Docs.DirName,
Docs.LeafName,
Lists.tp_ImageUrl
FROM
Lists
CROSS APPLY
TVF_AllListsAux_NoLock_ListId(Lists.tp_SiteId, Lists.tp_ID) AS ALAux
INNER JOIN
Docs
ON
Lists.tp_RootFolder = Docs.Id AND
Lists.tp_WebId = Docs.WebId
WHERE
tp_BaseType <> 1 AND
Lists.tp_SiteId = YOUR_SITE_ID
) As nLists
ON
Webs.Id = nLists.tp_WebId
LEFT OUTER JOIN
(
SELECT
(SUM(CAST((ISNULL(Docs.Size,0)) AS BIGINT))) As DocSizes,
Docs.ListId,
Docs.SiteId
FROM
Docs
WHERE
Docs.Type = 0 AND SiteId = YOUR_SITE_ID
GROUP BY
Docs.ListId,Docs.SiteId
) As DocsInList
ON
DocsInList.ListId = nLists.tp_ID
LEFT OUTER JOIN
(
SELECT
(SUM(CAST((ISNULL(tp_Size,0)) AS BIGINT))) As UserDataSize,
tp_ListId
FROM
UserData
GROUP BY
UserData.tp_ListId
) AS UserDataInList
ON
UserDataInList.tp_ListId = DocsInList.ListId
ORDER BY TotalSize DESC
Возвращает все списки всех сетей, суммируя размеры элементов и прикрепленные документы. Библиотеки документов не включены, используйте это:
SELECT
Lists.tp_Title,
Lists.tp_ID as Id,
SUM(Docs.Size/1024 + Docs.MetaInfoSize/1024)/1024 AS SizeMB,
COUNT(*) as NumberOfFiles
FROM dbo.Docs
INNER JOIN Webs ON Webs.Id = Docs.WebId
INNER JOIN Lists ON Lists.tp_ID = Docs.ListId
WHERE Docs.Size > 0
GROUP BY Lists.tp_Title,Lists.tp_ID