SharePoint Online: How to Change the Author in Modern Page?

Requirement: Set Author in the header section of the modern SharePoint Online page.

How to change the author in SharePoint Online Modern Pages?

Setting the author field in SharePoint Online modern pages is relatively straightforward. Here are the steps to add or change the page author:

  1. Simply click on the author field in the title area and start typing the user name. If there is an existing author set, You can remove it by clicking on the “x” symbol and entering the new Author.
  2. Enter the name or email of the author in the author box. You’ll get a list of available users in the drop-down.
  3. Pick the desired author and publish the page.
sharepoint online change page author

PowerShell to Set Author in Modern SharePoint Online Pages

How about changing the Author using PowerShell? Here is the PowerShell to set the Author in the Page Header area.

#Parameters
$SiteURL = "https://crescent.sharepoint.com/sites/Marketing"
$PageName = "Home.aspx"
$AuthorEmail = "mark@crescent.com"

Try {
    #Connect to PnP Online
    Connect-PnPOnline $SiteURL -Interactive

    #Get the Page
    $Page = Get-PnPPage -Identity $PageName

    #Resolve the Author User
    $Author = Get-PnPUser | Where-Object Email -eq $AuthorEmail
    If($Author -eq $null) {        
        $Author = New-PnPUser -LoginName $AuthorEmail
    }

    #Set the Authors and AuthorByLine properties of the PageHeader - in JSON format
    $Page.PageHeader.Authors = "[{`"id`":`"$($Author.LoginName)`"}]"
    $Page.PageHeader.AuthorByLine = "[`"$($Author.Email)`"]"

    #Save the changes and publish the page
    $Page.Save() | Out-Null
    $Page.Publish()
}
Catch {
    write-host -f Red "Error:" $_.Exception.Message
}

Salaudeen Rajack

Salaudeen Rajack - Information Technology Expert with Two-decades of hands-on experience, specializing in SharePoint, PowerShell, Microsoft 365, and related products. He has held various positions including SharePoint Architect, Administrator, Developer and consultant, has helped many organizations to implement and optimize SharePoint solutions. Known for his deep technical expertise, He's passionate about sharing the knowledge and insights to help others, through the real-world articles!

5 thoughts on “SharePoint Online: How to Change the Author in Modern Page?

  • I want to dynamically display the name of the current user on the site page instead of an author. Is that possible? Thanks.

    Reply
  • Can we get an export of all published pages and their authors? We still have pages that have authors who have the left organisation. Need an easy way to identify these…

    Reply
  • If I want to remove the Author Profile completely from the site page and do this for multiple pages, how will I modify this script ?

    Reply
    • Here is how to get all pages:

      #Get All Pages from "Site Pages" Library
      $Pages = Get-PnPListItem -List SitePages -PageSize 500
      
      #Iterate through each page
      ForEach($Page in $Pages)
      { 
          #Get the page name
          $PageName = $Page.FieldValues.FileLeafRef
      
          #Get the Page
          $Page = Get-PnPPage -Identity $PageName
      
          #Do something with the page
      }
      
      Reply
  • Can the updated AuthorByLine user gets, SP notification emails related to page comments and likes?

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *