ETag of a file or folder doesnt change when a share link is removed

Sangeetha Janakiraman 0 Reputation points
2023-01-18T20:44:37.02+00:00

When a share link is removed from file or folder, eTag doesnt change.

Steps to try

  1. Get Item details using Graph Endpoint returns the file details along with permission. eTag is 1 /users/<userid>/items<itemid>?expand=permissions
  2. Add a share link to the file. Get Item details again. eTag is 2
  3. Remove the share link from the file. Get Item details again. eTag remains 2. I expect it to be 3 as metadata of a file changed.
  4. If a direct permission is added and removed, eTag changes as expected.
Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,521 questions
OneDrive
OneDrive
A Microsoft file hosting and synchronization service.
799 questions
OneDrive Management
OneDrive Management
OneDrive: A Microsoft file hosting and synchronization service.Management: The act or process of organizing, handling, directing or controlling something.
1,116 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Tasadduq Burney 8,361 Reputation points MVP
    2023-01-18T20:51:23.01+00:00

    When a share link is removed from a file or folder in OneDrive, the eTag value does not change. This is because the eTag value is based on the metadata of the file or folder, and share links are not considered part of the metadata.

    The eTag value is used to indicate whether a file or folder has been modified. When a file or folder is modified, its eTag value changes. However, when a share link is added or removed, the file or folder's metadata is not modified, so the eTag value does not change.

    In your scenario, you will have to check the file or folder's permissions to determine whether a share link has been added or removed. The Microsoft Graph Permissions API can be used to retrieve the permissions for a file or folder, and the ShareType property of the permission can be used to determine whether a share link has been added.