none
PowerShell script to display all items of "Pages" library from a SharePoint online site and sub site. RRS feed

  • Question

  • Hi,

    any PowerShell script to display(export to .csv)  all items of "Pages"  library from a SharePoint online site and sub site would be helpful.

    Thanks,

    Tuesday, May 1, 2018 4:06 AM

All replies

  • Hi,

    Do you mean that you want to get all items in the Page library?

    If yes, you can use the following PowerShell script.

    $Context = New-Object Microsoft.SharePoint.Client.ClientContext($SiteURL)
    
    $SitePassword = ConvertTo-SecureString $SitePwd -AsPlainText -Force
    $Creds = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($SiteUser,$SitePassword)
    $Context.Credentials = $Creds
    
    $web = $Context.Web 
    $Context.Load($web)
    $Context.ExecuteQuery()
    
    $List = $Context.Web.Lists.GetByTitle('<List name>')
    $Context.Load($List)
    $Context.ExecuteQuery()


    Best Regards,

    Carl Zhou


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnsf@microsoft.com.


    Click here to learn more. Visit the dedicated forum to share, explore and talk to experts about Microsoft Teams.


    Wednesday, May 2, 2018 7:58 AM