Un esempio in PowerShell per SharePoint 2010 di come fare una query ricorsiva su più siti per elencare il contenuto delle liste utilizzando l'oggetto SPSiteDataQuery

PowerShell

$web = Get-SPWeb http://sharepoint2007/sito1
$query = New-Object Microsoft.Sharepoint.SPSiteDataQuery
//$query.Lists = "<Lists ServerTemplate='20101'/>";
$query.ViewFields = "<FieldRef Name='ID' /><FieldRef Name='Title' /><FieldRef Name='FileRef' /><FieldRef Name='EncodedAbsUrl' />";
$query.Webs = "<Webs Scope='Recursive' />";
$query.RowLimit = 1000
$web.GetSiteData($query) | Format-List
che da un risultato simile a questo

Text

ListId        : 1500A7AE-D611-44C7-B89D-1934F6F034B4
WebId         : 4E5E5E32-9CED-4FB7-B96B-9DEFA28370AF
ID            : 1
Title         : Get Started with Microsoft SharePoint Foundation!
FileRef       : 1;#Lists/Announcements/1_.000
EncodedAbsUrl : http://demo2010a:82/

ListId        : 672F229F-AF85-46CF-8264-BF9469174F8A
WebId         : 4E5E5E32-9CED-4FB7-B96B-9DEFA28370AF
ID            : 1
Title         : Creazione site collection con DB separato
FileRef       : 1;#Lists/Tasks/1_.000
EncodedAbsUrl : http://demo2010a:82/

ListId        : 672F229F-AF85-46CF-8264-BF9469174F8A
WebId         : 4E5E5E32-9CED-4FB7-B96B-9DEFA28370AF
ID            : 2
Title         : Creazione content type
FileRef       : 2;#Lists/Tasks/2_.000
EncodedAbsUrl : http://demo2010a:82/

Vedi anche SPSiteDataQuery Class
Tags:
PowerShell200 SharePoint498 SharePoint 2010224
Potrebbe interessarti anche: