web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Update the Created By ...
Power Automate
Unanswered

Update the Created By (AuthorID) Field of a SharePoint Online List Item with Power Automate

(18) ShareShare
ReportReport
Posted on by 103

Disclaimer: There are a few steps required to get this done, but the reward at the end is worth the effort.


Get Created By field GUID

To update the Created By column, we need to first find it’s Field GUID.  Because the Created By column is set to read only, we will query our list for all fields but filter them to only show ones set ReadOnlyField = true

  1. Create a new Send HTTP Request to SharePoint action.  Fill in, adjust according to your tenant / match the rest.
    FraserM_0-1602746130673.png
    URI: _api/web/lists/getbytitle('Your%20List%20Name')/fields?$filter=ReadOnlyField eq true

  2. Run your flow and open the run history, we want to get at the Outputs from the action we created in step 1.
    FraserM_1-1602746130681.png
    Copy the body content and paste it into a text editor of your choice.

  3. Search for Created By in your text editor, and just a few lines up from where it appears is your Created By Field GUID.  Note this because we are going to need it later.
    FraserM_2-1602746130685.png
    You can remove the Send HTTP Request action we created in step 1 – no longer required.

Get UserID Number to write to Created By column

Created By is a person column that has an associated AuthorId field.  The AuthorId field contains a numeric value (ie: 11) which is used to populate the Created By person data.  Our end goal (soon)-- to simply update this field to the numeric value of the user we want listed in the Created By column.

First we need to get our replacement numeric value from somewhere. In the following example I look up a sharepoint users numeric value, simply by supplying their email address (in the example this was dynamic content supplied by a person column in my list called 'EmployeeName')

  1. Create a new Send HTTP Request to SharePoint action.  Fill in, adjust according to your tenant / match the rest.  Let’s get some user data we can pull details from.
    FraserM_3-1602746130689.png
    Uri: _api/web/siteusers/getByEmail('[USER@EMAIL.ADDRESS]')
    Plug in any dynamic content that will provide you with an email address
    FraserM_4-1602746130692.png

     

  2. Now that we have this collection of user data, instead of messing around with formulas to isolate the Users ID #, it’s JSON… let’s parse it.  Create a new Parse JSON action and plug in Body from the dynamic content provided by the Send HTTP Request of the step above.
    FraserM_5-1602746130696.pngFraserM_6-1602746130697.png
    This guide is long enough, if you don’t know how to use a Parse JSON action / generate from sample – it’s super easy to find a how-to on the net.  Go check that out and come back.  Forgive me.

    The Parse JSON action will now create a schwack of dynamic content that can be selectable in future actions.  One dynamic content entry called 'Id', is the numeric value associated to the email address we provided above and exactly what we are going to plug into the AuthorId field!  But, first we must...

Unlock the Created By column

Now that we have taken care of all the prerequisites, let’s get on with unlocking the column for manual updating.  The column is locked by SharePoint automatically after a record gets updated - if you don't unlock it before attempting to update it's contents, the column doesn't get changed.

 

Create a new Send HTTP Request to SharePoint action.  Fill in, adjust according to your tenant/list/Created By fields GUID, match the rest.
FraserM_7-1602746130702.png
Uri: _api/web/lists/getbytitle('Your%20List%20Name')/fields(guid'Your-GUID-goes-here-yasss')
Body:
{ '__metadata': { 'type': 'SP.Field' }, 'ReadOnlyField': false }

Update the Created By field

Now that the Created By column is unlocked, we can update its fields.

 

Create a new Send HTTP Request to SharePoint action.  Fill in, adjust accordingly to your tenant/list, match the rest.
FraserM_8-1602746130707.png
Uri: _api/web/lists/getbytitle('Your%20List%20Name')/items('[ID]')
The ID you should be able to plug in from dynamic content from other actions (ie: Get Items, When a New Item is Created, etc)

Body: { '__metadata': { 'type': 'SP.Data.Your_x0020_List_x0020_NameListItem' }, 'AuthorId': [Id] }
For the [Id] shown, we plug in some dynamic content from our Parse JSON Action.  Note: !pay attention here to cAse.  Use the dynamic content Id (uppercase i lowercase d) -- and not id (all lowercase) when you choose.
FraserM_9-1602746130711.png

 

Re-lock the Created By column

Now we can set the Created By column back to read-only.

 

Create a new Send HTTP Request to SharePoint action.  Fill in, adjust according to your tenant/list/Created By fields GUID, match the rest.
FraserM_10-1602746130716.png
Uri: _api/web/lists/getbytitle('Your%20List%20Name')/fields(guid'Your-GUID-goes-here-yasss')
Body: { '__metadata': { 'type': 'SP.Field' }, 'ReadOnlyField': true }

 

I spent the better part of a day sifting through bits and pieces from various forums -- most of them producing more questions than solutions.  Hopefully, you find this helpful (and save yourself some time).

-F

Categories:
I have the same question (0)
  • Illmas Profile Picture
    3 on at

    Helloe Fraser

     

    Your steps are detailed however as a non programmer iam not able to use it across for my scenario.

     

    Could this technique be used dynamically to update a Sharepoint list item that has been copied from another list?

     

    I have flow that that copies across from list 1 to list 2 if the user ticks a yes.

    I would like the flow to update the created by or modified by field for the copied item through the same flow while its being created or updated.

     

    All help is appreciated.

     

     

  • bradleyhorton Profile Picture
    187 on at

    Hi @FraserM Would this work the same for editing the Created By column in a document library, rather than a list?

     

    I've tried to follow this through and am able to amend other columns, just not the AuthorID/EditorID so I'm guessing the field isn't unlocking for me to edit but I'm not sure why. It might just be I'm getting the wrong FieldID.

     

    Any help greatly appreciated.

     

    Here's my current HTTP request to unlock the field 

    bradleyhorton_0-1606928258229.png

     

  • Community Power Platform Member Profile Picture
    on at

    I follow all the steps and the result is ok in the flow, but don´t change the Author in the list, I test it changing the ID, but still continue with the same author ID

  • Community Power Platform Member Profile Picture
    on at

    Wow, just wow, you man just saved my ass. Thanks a lot for sharing this, if you ever visit Czech Republic I owe you a beer 🙂 

  • lukaszpudlo Profile Picture
    3 on at

    I'm trying to anonymize entries in a SharePoint list that are more than one year old, that is, I would like to change all Created By for those entries to "Anonymous".

     

    I imagine that I can skip the Parse JSON part of the above manual. When I'm running the last Send an HTTP request to SharePoint, I'm getting an error message, saying that the format is incorrect. The details shows it's something to do with the items('[ID]').

     

    This is what I have at the moment:

     

    lukaszpudlo_0-1609805583744.png

     

    Do you have any suggestions on how to achieve a flow that would allow me to anonymize data that is older than one year?

  • Community Power Platform Member Profile Picture
    on at

    Hello Fraser,

     

    thanks for your instructions.

     

    I'm trying your solution, but the AuthorId stubbornly keeps its original value.

    Do you know if something has changed why this wouldn't be working anymore?

     

    Kind regards,

    Frans

  • sliu17 Profile Picture
    6 on at

    Hi, 

     

    I am hitting an error on the step where it tries to update the created by field but i am getting :

     

    Invalid JSON. A token was not recognized in the JSON content.
     
    Any ideas?
  • sliu17 Profile Picture
    6 on at

    I was able to figure out the issue. Schema was not all there when i generated a sample so recreating that resolved my invalid JSON error. 

     

    IF you follow the instructions, you should have no issues. if you do run into problems, i would suggest double checking every config against the posts and if you continue to have issues, rebuilding the components or checking your schema should resolve most issues. 

  • rl17 Profile Picture
    10 on at

    I've been through this several times and I'm missing something.

     

    I get an error on the UpdateCreatedBy request:

    A 'PrimitiveValue' node with non-null value was found when trying to read the value of a navigation property; however, a 'StartArray' node, a 'StartObject' node, or a 'PrimitiveValue' node with null value was expected.

     

    My Unlock step (below) works fine. I can even do a GET request after this, read the fields as described (omitting the 'read only' filter, and confirm that the read only flag changes to false.

    rl17_0-1615502517210.png

     

     

    Here is my UpdateCreatedBy.. step:

    rl17_2-1615502739746.png

    Body field contains: { '__metadata': {'type': 'SP.Data.FlowtestListItem'},'AuthorID': 59} 

     

    I manually entered the item id (confirmed it exists!) and the Author Id (found per another GET request). I will change them to be dynamic content when the Flow test run is working.

    Note that I changed AuthorID to Author. Author is what shows up as the "InternalName" and "StaticName" slightly above the "Title": "Created By" as found via the GET step to find the GUID.

     

    If I have 'AuthorID' in my body field I get this error:

    The property 'AuthorID' does not exist on type 'SP.Data.FlowtestListItem'. Make sure to only use property names that are defined by the type.

     

     

    In case it helps, here's the raw input that I can pull after the Flow test fails:

    {
        "host": {
            "connectionReferenceName""shared_sharepointonline",
            "operationId""HttpRequest"
        },
        "parameters": {
            "parameters/method""PATCH",
            "parameters/uri""_api/web/lists/getbytitle('flowtest')/items(3)",
            "parameters/headers": {
                "content-type""application/json;odata=verbose",
                "IF-MATCH""*",
                "X-HTTP-Method""MERGE"
            },
            "parameters/body""{ '__metadata': {'type': 'SP.Data.FlowtestListItem'},'Author': 59}"
        }
    }
     
    As one other oddity... my list name is 'flowtest' (all lower case) but if I use SP.Data.flowtestListItem (i.e. lowercase f) I get the following error:
    A type named 'SP.Data.flowtestListItem' could not be resolved by the model. When a model is available, each type name must resolve to a valid type.
    The error goes away by changing to SP.Data.FlowtestListItem
     
     
    If anyone has any ideas or further suggestions, I look forward to them. What started out as a very simple task has taken much more effort than anticipated.
    If there's an easier way... I don't mind jumping ship and taking the easy way out! 🙂
    My goal is to send a form to users, have them fill it out, have the Flow transfer the data into a Sharepoint List, and then have the Sharepoint List Item-level permissions set to allow users to come back and edit their submissions but not edit others (i.e. a user can edit items they created, which obviously fails if the Flow overwrites the creation and shows me as the creator instead of the user).
  • FraserM Profile Picture
    103 on at

    @lukaszpudlo The [ID] at the end of the Uri is dynamic content .  It will be a numeric value that corresponds with the row number of the item being processed.  ie: /items(1) i think would be the first row in the list.
    (I can see from the screenshot you are currently just typing in [ID] )

    Uri: _api/web/lists/getbytitle('Your%20List%20Name')/items('[ID]')

    Next, where you have typed 'Anonymous' that won't work.  That field is a numeric value assigned to all sharepoint users (and not a string of text as you have typed in). I have updated my original post above to better explain this - try passing a value in there just for fun.. say 1 or 2 just for fun 😉

    Body: { '__metadata': { 'type': 'SP.Data.Your_x0020_List_x0020_NameListItem' }, 'AuthorId': [Id] }

     

    As for an idea on how to anonymize after a year.. possibly.  From what I can see you want to set it to 'Anonymous' so why not create a user in O365/SharePoint called Anonymous, use the LookupSPUserId method i outlined to grab the associated Id numeric value and then run a scheduled flow to check for entries aged to fit your criteria, and set the AuthorId field on them.  You should be able to use an user@tenant.onmicrosoft.com address also so you wont need to assign any licenses. Follow up info here should you need to poke sharepoint to create the user object (post by Tiago Paes)

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 538 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 405 Moderator

#3
abm abm Profile Picture

abm abm 252 Most Valuable Professional

Last 30 days Overall leaderboard