SharePoint REST API是否支持SP.ObjectSharingInformation.getObjectSharingInformation方法?
Great question! Let's break this down clearly: There isn't a direct 1:1 REST API equivalent for the SP.ObjectSharingInformation.getObjectSharingInformation JSOM method, but you absolutely can retrieve the list of users a SharePoint list is shared with using alternative REST endpoints that deliver the same (or even more) relevant information.
Here are two reliable approaches to get the shared user list for your SharePoint list:
1. Use Role Assignments to retrieve all authorized users/groups
This endpoint gives you a full breakdown of all role assignments on the list, including the users/groups and their associated permissions. You can filter this data to extract your shared users list.
Example REST Request
GET /_api/web/lists/getbytitle('YourListName')/roleAssignments?$expand=Member,RoleDefinitionBindings
What this returns:
- Each entry in the response includes a
Memberobject (either a user or SharePoint group) andRoleDefinitionBindingsthat detail the permission level (like "Edit", "Read") assigned to that member. You can parse this to extract only user entries and their corresponding access levels.
2. Use the getSharingInformation method (SharePoint 2013+)
This method is designed specifically to return sharing-related details, mirroring much of what the JSOM SP.ObjectSharingInformation.getObjectSharingInformation method provides. It requires a POST request with a body specifying which details you want to include.
Example REST Request
POST /_api/web/lists/getbytitle('YourListName')/getSharingInformation Content-Type: application/json;odata=verbose
Request Body
{ "request": { "__metadata": { "type": "SP.SharingInformationRequest" }, "IncludeAnonymousLinks": false, "IncludeUserInfo": true, "IncludePermissions": true } }
What this returns:
- A response containing properties like
SharedUsers(an array of user objects with their permission details),HasUniquePermissions, and other sharing-related metadata. This is the closest you'll get to the output of the JSOM method you mentioned.
Both approaches work well depending on your needs—if you want a full view of all permissions (including groups), go with the role assignments endpoint. If you want a focused set of sharing-specific data, getSharingInformation is your best bet.
内容的提问来源于stack exchange,提问作者Jesse Lynn

