The main concept of SharePoint did not change through these last years; by default, all members can write on a SharePoint site, depose files, create content and pages.

Since the modern pages, some notions are more "obvious", like the page author one.

Programmatically, you can access Author and Author Byline metadata, but what is the main difference, and what is the impact.

Author Byline

SharePoint Page - Author Byline

The author byline is mostly used as an indication for the readers about who is the original author of the contents and not necessarily who wrote the page. Specifying the author byline does not grant any additional access or feature for this user.

This can be useful when you have some marketing people who have the habit to write content who can specify the "author byline" who at the origin, does not have this habit.

As you can see, you can easily edit it from the SharePoint interface and even choose to keep it empty.

[note]Note

The internal name of this field is _AuthorByline

Author

Regarding the author, it is totally different. The field that stores the information about the author of the page is called Created By too. From a SharePoint list/library view, you should display Created By field to see who created an item.

Contrary to the Author Byline, this field is not visible from the edit page or from the form of an item. This one cannot be edited from the item form or a quick edit view either.

Apart from being identified as the creator of a page, this one will receive notifications when:

  • Someone liked the page
  • Someone wrote a comment

The main issue of the native behavior can become restrictive for many reasons:

  • The user account that creates the page, creates a lot of other pages. Then, this one will receive a lot of notifications... spammm
  • The account that used to create pages is a service account (no mailbox)... This means no notification
  • Another user account that not create the page should receive the notification (delegation)
  • A group of users (Office 365 or security group with mail address) should be notified and not only the user account that creates the page

With this information in mind, you can ask: "Ok, I need to change the value of this metadata, how I can do that? 🧐"

[note]Note

The internal name of this field is Author

Scripts to Update Author

Create a script to update the Author for one or several pages (even an items list) can be a good option.

Below, different samples to update this field via PowerShell, bash, and REST API.

You will note that Editor is specified too into the samples. This is totally normal because if you do not specify the editor, the action returns an (it is possible to specify another user account than the author one).

The cons of the scripts method are:

  • You need to execute manually the script to update one or several pages
  • You need to set up a scheduled task that will update at the same frequency the author of the pages

PowerShell

Set-PnPListItem -List "SitePages" -Identity 10 -Values @{
    "Editor" = "[email protected]";
    "Author" = "[email protected]";
} -SystemUpdate
Update Editor and Author field values with PnP PowerShell

CLI for Microsoft 365

m365 spo listitem set --listTitle "Site pages" --id 10 --webUrl https://contoso.sharepoint.com/sites/projet-x --Editor "[{'Key':'[email protected]'}]" --Author "[{'Key':'[email protected]'}]
Update Editor and Author field values with CLI for Microsoft 365

REST API

POST _api/web/Lists/GetbyTitle('Site%20pages')/items(10)/ValidateUpdateListItem() HTTP/1.1
Host: contoso.sharepoint.com
Content-Type: application/json; charset=utf-8
X-RequestDigest: [digest]

{
    "formValues": [
        {
            "FieldName": "Editor",
            "FieldValue": "[{'Key':'[email protected]'}]"
        },
        {
            "FieldName": "Author",
            "FieldValue": "[{'Key':'[email protected]'}]"
        }
    ],
    "bNewDocumentUpdate": false
}
REST API endpoint to update SharePoint item author

Power Automate

An "alternative" to the scripts that the main cons that does not allow to update the Author field "On-Demand", is to use a Flow.

This flow can launch an Azure Function for executing bash, node, or PowerShell script. The flow can send the REST API HTTP request directly too with no additional service.

Let us take a look at the steps to create this Flow.

Step 1: Create the Flow

Create a new Automated Cloud Flow and choose the trigger When a file is created or modified (property only) or When an item is created or modified

Step 2: Configure the Trigger

Configure the trigger with the target SharePoint Pages Site.

  • Site Address: https://contoso.sharepoint.com/sites/project-x
  • List Name: Site Pages (Power Automate does not purpose the site pages from the dropdown list. You must specify it manually)

Step 3: Add Condition

Flow condition before changing the page author

With no condition, when you will save the flow and launch it, you create an infinite loop. Because the trigger is called each time a page is created or modified, and each time you will update the Author field (even if the value does not change) the trigger will be called again... πŸ˜‘

Another side effect is when you will create a new page, the trigger will be called; you will not have the time to edit the page that the flow will update it; when you will save the page, SharePoint will say you that someone else has edited the page and you must reload the page (of course, you will lose all changes).

The suggested condition is the following one:

  1. Check the version of the page: when a page is edited, the minor version is incremented (0.1, 0.2, 0.3, etc.). Once an editor has done, he will Publish the page. Once a page is published, the version becomes a major version (ex: 1.0).
    Here is, the condition: Version number | ends with | .0
  2. Check the value of the Author field: if the Author is already the good one, it is not necessary to update the page Author once again πŸ˜‰
    Here is, the condition: Created By Email | is not equals to | Author
[success]Tips

In this case, we stored the new Author email address into a Flow variable because it will be reused later to update the Author field value. You just have to edit the variable value to update the condition and the author of the page.

Step 4: Update the Metadata

Flow action to update the page Author field value

It is time to update the page metadata now; In other words, update the Author field value.
To perform this change, they are no existing Flow Action to do that directly. It is necessary to Send an HTTP request to SharePoint.

  • Site Address: your SharePoint site that contains the page
  • Method: POST to send the data
  • Uri: the same REST API URL than above _api/web/Lists/GetByTitle('Site Pages')/items([ITEMID])/ValidateUpdateListItem()
  • Headers: no header needed. Power Automate embed the account information that used to launch the flow
  • Body: the same body as the REST API above
{
    "formValues": [
        {
            "FieldName": "Editor",
            "FieldValue": "[{'Key':'[Modified By Email]'}]"
        },
        {
            "FieldName": "Author",
            "FieldValue": "[{'Key':'[Author Variable]'}]"
        }
    ],
    "bNewDocumentUpdate": false
}

That's it! πŸ‘πŸ»

Step 5: Publish the Page

Flow action to republish the page with the new Author field value

One point I omit to mention in the script's part, after editing the metadata of the page, this one is checkout again. It is necessary to publish a new major version of the page but Power Automate does not have an Action to do this too. It is necessary to Send an HTTP request to SharePoint.

  • Site Address: your SharePoint site that contains the page
  • Method: POST to send the data
  • Uri: the specific site pages REST API URL to publish a page _api/sitepages/pages([PAGE ID])/publish
  • Headers: no header needed. Power Automate embed the account information that used to launch the flow
  • Body: no body is needed

Here we go 😏 Thanks to this Flow, you will change automatically the Author of the pages when they are Published and keep them publish.

Step 6: If no

Define a default action if the condition return false

If you want to put something into the "If no" part of the condition, even if it is not necessary (I think), you can add a Terminate action with a Succeeded status (because they are no error in our case) πŸ˜‰.

Conclusion

The Author field is not intended for edited but it is possible to edit it programmatically.

This field is a sort of "system field" that should not be edited but in accordance with modern behavior, a notification is sent to the Author (alias Created By) when someone likes or comment on a page, it becomes easy to understand that can be necessary to change the author of the page(s).

Perhaps, Microsoft will change this behavior by sending the notification to Author Byline like suggested in this UserVoice or maybe differently:

I suggest you ....
  • 216 votes
  • 14 comments

News post notifications to author, not creator

In our organisation, we often create news posts for others that do not have the rights to do so. We then set them as the Author of the news post.

However, when others subsequently comment or "like" the news post, the email notification is sent to the creator and not the author.

We would lik...



Hoping this post will help you πŸ˜‰

You may also be interested in