Is there a way, using the rest end points to see if a file has been shared externally or a guest link has been created? I would like to create a way to look at my OneDrive and check all files within to if they have shared.
I am using _api/web/lists/getByTitle(‘My List’)/items to get my files.
I have tried using /_api/web/GetFileByServerRelativeUrl(file relative URL’)/ListItemAllFields/roleassignments but this doesn’t see to give me anything related to external sharing. I checked the file before and after sharing and the role assignements were the same. I am guessing this is correct because an anonymous guest link wouldn’t have a role assignment.
Any help appreciated thanks!
I don’t see anything in the role assignments, definition bindings or user objects that indicates if an item was shared externally or which external users have access to it.
What I ended up doing was getting the users under each role assignment (full control, contribute, view, etc) then matching those with a list of external users provided by the Microsoft SharePoint Online powershell cmdlet (Get-SPOExternalUser). That cmdlet only provides external users at a site collection level but at least I know which users are external and can then match their permissions at the site or item level.
Let me know if you find a better way or want more details on how I did it.