1

We are using SharePoint client object model (CSOM) and REST/OData endpoints to retrieve/manage data on sharepoint.

  1. Is there anyway to get information on the user performing the MOVE on a file (for example, move file from folder A to folder B within same site collection)? When I use this REST API call before and after the move, Author and Editor remains the same even though a completely different user moved the file from folder A to folder B. SPChangeItem does not seem to have any members with this information either.

    https://{site_url}/_api/web/GetFileByServerRelativePath(DecodedUrl=@fileUrl)?$expand=Author,ListItemAllFields,ListItemAllFields/ParentList,ListItemAllFields/ParentList/ParentWeb&$select=UniqueId,Author/LoginName,Author/Email,Author/Id,Editor/LoginName,Editor/Email,Name,UserName,ServerRelativeUrl,MajorVersion,MinorVersion,Length,ListItemAllFields&@fileUrl={url_encoded_file_path}
    
  2. Is there anyway to get logged in user while using REST API? When I use this REST API call, Id returned is the user corresponding to Bearer accesstoken.

    https://{site_url}/_api/Web/CurrentUser?$select=Id
    
Rashmi
  • 11
  • 1

1 Answers1

0

When moving a file to another folder, the metadata including author/editor is remained the same one, what changed is only the location. This is by designed.

If we want to know the user who performed this operation, we could check the version events of the file as it will immediately prompt an modification event when moving a file.

Rest API endpoint:

_api/Web/GetFileByServerRelativePath('filepath')/VersionEvents

Thanks

Baker_Kong
  • 1,739
  • 1
  • 4
  • 9