Getting all pages list having .aspx in the SHarePoint site collection

sns 9,246 Reputation points
2023-02-16T15:39:09.56+00:00

Getting all pages list having .aspx in the SHarePoint site collection and export it to CSV file

that should include "site pages" library,

it is SharePoint 2016

Is there any to achieve it? Please suggest, thank you

Microsoft 365 and Office | SharePoint Server | For business
Microsoft 365 and Office | SharePoint | For business | Windows
0 comments No comments
{count} votes

Accepted answer
  1. AllenXu-MSFT 24,951 Reputation points Moderator
    2023-02-17T06:17:34.7466667+00:00

    Hi @sns,

    Use the PowerShell below to export all .aspx pages to CSV in a SharePoint site.

    $spweb = get-spweb -identity "http://sp13/sites/test"
    $list = $spweb.lists["Site Pages"]
    $listItems = $list.Items
    $OutPutFile = "C:\Temp\Pages.csv"
    
    $DocumentTitleCollection=@()
    
    $list.Items | foreach {
    
       $ExportItem = New-Object PSObject
       $ExportItem | Add-Member -MemberType NoteProperty -name "PageName" -value $_["Name"]
       $DocumentTitleCollection += $ExportItem
    }
    
    $DocumentTitleCollection | Export-CSV $OutPutFile -NoTypeInformation
    
    #Clean up
    $spWeb.Dispose()
    
    

    Here is the screenshot of the CSV file generated in Excel.
    User's image


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.