You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I try to retrieve the role assignments of a file an exception is thrown if there is a Sharing link.
The error is the following:
HttpResponseCode: 404
Code: System.ArgumentException
Message: Can not find the principal with id: 27.
ClientRequestId: af5209a1-407b-8000-0bec-4440f98dde8d
SPClientServiceRequestDuration: 23
X-SharePointHealthScore: 0
X-SP-SERVERSTATE: ReadOnly=0
the id 27 in the example matches the assigned id of the sharing link
Steps to reproduce
See code:
I want to extract permissions that includes a specific permission kind
varlistItem= file.ListItemAllFields;await listItem.LoadAsync(w => w.HasUniqueRoleAssignments,w => w.RoleAssignments.QueryProperties(p => p.PrincipalId,p => p.RoleDefinitions.QueryProperties(rd => rd.Id,rd => rd.Name,rd => rd.BasePermissions)));varras= listItem.RoleAssignments;PermissionKindpermissionKind= PermissionKind.ViewListItems;//The following line throws the exceptionList<IRoleAssignment>filteredRoles= ras.AsRequested().Where(ra => ra.RoleDefinitions.ToList().Any(rd => rd.BasePermissions.Has(permissionKind))).ToList();
Expected behavior
No exception thrown and have access to the required roles assignments
Category
Describe the bug
When I try to retrieve the role assignments of a file an exception is thrown if there is a Sharing link.
The error is the following:
HttpResponseCode: 404
Code: System.ArgumentException
Message: Can not find the principal with id: 27.
ClientRequestId: af5209a1-407b-8000-0bec-4440f98dde8d
SPClientServiceRequestDuration: 23
X-SharePointHealthScore: 0
X-SP-SERVERSTATE: ReadOnly=0
the id 27 in the example matches the assigned id of the sharing link
Steps to reproduce
See code:
I want to extract permissions that includes a specific permission kind
Expected behavior
No exception thrown and have access to the required roles assignments
Environment details (development & target environment)
Thanks for your contribution! Sharing is caring.
The text was updated successfully, but these errors were encountered: