question

DeepikaSingh-5760 avatar image
0 Votes"
DeepikaSingh-5760 asked AmosWu-MSFT commented

MS Graph API: shared file scope

hi, Could you help in knowing the scopes of files which has been shared? Since the scope of files shared in MS graph API has three parameters i.e. "users || anonymous|| organization"

Even if the file is shared outside the organization i.e externally(confirmed from the Info Icon of the one drive while sharing file ), then also the shared scope displays "users"!

So can I get the sharp distinction regarding the scope of shared files, so that the files further could be categorized as internally/externally shared?

office-sharepoint-onlineoffice-sharepoint-server-development
· 4
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@DeepikaSingh-5760, Thank you for reaching out. It would be great if you can share the MS Graph API that you are using here so that it's easier or us to help you further.

0 Votes 0 ·

I have used following code of c# :
graphClient.Users[user.Id].Drive.Root.Children.Request().GetAsync().Result to get the drive items .

And for each Item one of the object parameter i.e shared is returned providing information about the shared state of the item. One of the properties among shared objects is scope which always exhibits users value regardless of the file being shared outside the organization.

Is there any other option to distinguish the files shared outside/inside the organization or to the anonymous user?












0 Votes 0 ·

@DeepikaSingh-5760, Thank you for sharing the details. I have moved this thread to the Sharepoint-Online team as we lack expertise on this ask.


0 Votes 0 ·

@DeepikaSingh-5760
Would you please provide us with an update on the status of your issue? If my reply helped you , you could accept as answer to help community members find the helpful information quickly.

0 Votes 0 ·

1 Answer

AmosWu-MSFT avatar image
0 Votes"
AmosWu-MSFT answered AmosWu-MSFT edited

In share advantced page(classicpage->share->Shared With->Advanced),we could not find any external user .
13306-result1.png
We could get internal user data via rest api.
13127-result2.png



result1.png (126.9 KiB)
result2.png (12.2 KiB)
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Could you please tell the concerned MS Graph API endpoints to be used for retrieving the shared files count internally and externally as well?

As previously, we have been using
GET /reports/getOneDriveActivityFileCounts(period='{period_value}')
but this also does not provide the distinction btw the files we shared internally and externally(as all the shared file falls under internally shared category irrespective of file shared externally).

Seeking for the optimum & quick response.
Thanks in advance.

0 Votes 0 ·

As far as I know, Graph API does not yet support this.
We could only change the external sharing setting at site level.
https://docs.microsoft.com/en-us/onedrive/user-external-sharing-settings#:~:text=In%20the%20left%20pane%2C%20select,level%2C%20and%20then%20select%20Save.

0 Votes 0 ·