0

I have to import so many views of a specific list (200+-) in SharePoint 2010.

I add the views to a wiki page with a web part list, but the web part list dropdown "Selected View" in the "Show Views" section of the Properties of the Web Part, doesn't show all the views, and i need to add all the views

How i can view all the views of the list? Or how i can add the WebPart views with CSOM? (I have certain knowledge in that, so if i can do that, since it is mechanical work it would be better).

The step to step of the work is:

  • Add WebPart List
  • Change the View of the list, the name of the WebPart and the audience
  • Apply changes
  • Add another and so on.

Thanks in advance boys, i love you

0

To set audience for a list web par, you could refer to here:

https://social.technet.microsoft.com/Forums/ie/en-US/c3c78200-1649-4545-849e-b76689d38dfc/set-target-audience-for-list-view-web-part-using-powershell-csom?forum=sharepointgeneral

    $List = $context.Web.Lists.GetByTitle("ListName")
    $context.Load($List)
    $context.ExecuteQuery()


    $Pages = $List.RootFolder.Files
    $context.Load($Pages)
    $context.ExecuteQuery()

    $Page = $Pages | Where {$_.Name -eq "ViewName"}
    $context.Load($Page)
    $context.ExecuteQuery()


    $WPM       = $Page.GetLimitedWebPartManager("Shared")
    $context.Load($WPM)
    $context.ExecuteQuery()

    $WebParts = $WPM.WebParts
    $context.Load($WebParts)
    $context.ExecuteQuery()

    $WebPart = $WebParts[0]
    $context.Load($WebPart)
    $context.ExecuteQuery()

    $WebPart.WebPart.Properties["AuthorizationFilter"] = "My Group"

    $WebPart.SaveWebPartChanges();
    $context.Load($WebPart);
    $context.ExecuteQuery();

To change the view, here is a demo for your reference:

Powershell CSOM to change web part view

| improve this answer | |

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.