-
As I understood, when reading the permissions of Securable, we also receive users who have permission through a sharing link, but I didn't find any Property which tells us that this permission is given by through a sharing link. Did I overlooked that or there is currently no way to find that out using PnPCore SDK? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
@bajce , if you lookup the returned
We currently did not wrap these sharing APIs in PnP Core SDK, so you'd have to call them using our custom API call feature: https://pnp.github.io/pnpcore/using-the-sdk/basics-customapirequests.html#making-a-custom-spo-rest-request Do note that there's a risk of being throttled if you'd start calling as part of iterating over all content in a tenant. context.Web.Load(p => p.SiteUsers, p => p.SiteGroups);
// code fetching the list and it's role assignments
foreach(var assignment in myList.RoleAssignments.AsRequested())
{
var assignedUser = context.Web.SiteUsers.AsRequested().FirstOrDefault(p=>p.Id == assignment.PrincipalId);
if (assignedUser != null)
{
// it's a user
}
else
{
var assignedGroup = context.Web.SiteGroups.AsRequested().FirstOrDefault(p => p.Id == assignment.PrincipalId);
// it's a group
}
} |
Beta Was this translation helpful? Give feedback.
@bajce , if you lookup the returned
PrincipalId
in the site users/groups (see csharp code snippet) you'll be able to get more information. In case of for example a list shared with an external user you'll see a group with a name like this "SharingLinks.6c3e69d8-85ba-4a74-a214-3ba666040c1b.Flexible.d2b42daa-4d3d-4076-ba1d-d4ce45524bc7". The first guid is the unique id of the item the share was added on (e.g. list id here), the second guid is the unique id of the share (=shareid). If it's sufficient to understand the share is external then with above you have all you need, if you need more details about the actual share you could consider calling theGetShareInformation
methods on for examp…