0

I am trying to find out the name of a user who has changed something in an SP list. I am calling this API:

https://tenant.sharepoint.com/sites/sitename/_api/web/lists/getbytitle('listname')/Items(ID)/versions

But there is no column, nor I cannot see, that indicates the person who has changed this Items (ID). This list has version control as shown below:

enter image description here

I can see who has approved it as shown below:

enter image description here

But do not know where to look to find the person who has changed this item.

1 Answer 1

0

You can get the name of user who changed list item using Editor field in API response.

Example:

If I run below API endpoint in browser:

_api/web/lists/getbytitle('ChildList')/Items(1)/versions?$select=Title,Editor,VersionLabel,OData__x005f_UIVersionString

I am getting this response:

<m:properties>
    <d:VersionLabel>2.0</d:VersionLabel>
    <d:Title>Child 1 of Parent 1</d:Title>
    <d:Editor m:type="SP.FieldUserValue">
        <d:LookupId m:type="Edm.Int32">6</d:LookupId>
        <d:LookupValue>Ganesh Sanap</d:LookupValue>
        <d:Email>ganesh@<tenant>.onmicrosoft.com</d:Email>
    </d:Editor>
    <d:OData__x005f_UIVersionString>2.0</d:OData__x005f_UIVersionString>
</m:properties>

Where Editor is the user who changed list item & created draft version 2.0.

So, you can get the name of user using something like Editor.LookupValue.

3
  • thanks for your time again, this still returns the user who has approved the change, not the user who actually changed it. Just a point: after the approval, the content gets slightly modified by the MS flow developed by the user who is approving the change (myself), so I still see my name as the person who has changed this item not the user who actually changed this item. Sep 14, 2021 at 19:59
  • 1
    If item is moodifed after user drafts a version, obviously modified by (editor) field will show the name of latest user. In that case, if you are running flow on item updation, you can create one more column in your list & update it with the name of user who drafted the list item (when approval status = "Pending"). Sep 15, 2021 at 2:13
  • 1
    Thanks Ganesh, I have already done it, but was not sure if I can obtain the user name automatically from SP rather than this customized column, so I guess there is no way to get it automatically without the help of a customised column to keep the username Sep 15, 2021 at 2:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.