0

I have different lists in different Websites that I would like to show in one webpart. I tried it using the ContentByQueryWebPart. By using the GUI, I only can choose one list which isn't enough. In addition to that, I need to solve this problem programmitically with Powershell. What I have so far:

$webpartmanager = $web.GetLimitedWebPartManager($rootSite, [System.Web.UI.WebControls.WebParts.PersonalizationScope]::Shared);
$webpart = New-Object Microsoft.SharePoint.Publishing.WebControls.ContentByQueryWebPart;
$webpart.Title = "Information";
$webpartmanager.AddWebPart($webpart, $webpartzone, 2);

It works so far, a Webpart with the Title "Information" is succesfully created. I just need the method / property with which I can put in mukltiple lists.

Can anybody help?

0

Content Query WebPart has a property named ListsOverride. This can be used to set multiple lists in CQWP. Set this property with the IDs of the lists. Example:

<Lists><List ID="31A7C09D-52CC-4585-B998-A3F180A9BD07"/><List ID="7382D66D-2E4C-47CB-A95C-5EECD68F5E61"/></Lists>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.