Graph API /me/drive/sharedWithMe regression: returns 1 item via ROPC; UI/Graph Explorer show 6 (worked until ~2 weeks ago)

Macri Alessandro 45 Reputation points
2025-11-11T17:26:19.7+00:00

Using an App Registration with delegated ROPC (username+password) for a service account, GET https://graph.microsoft.com/v1.0/me/drive/sharedWithMe returns a single item (200 OK).
The same user signed in via OneDrive web UI and Graph Explorer sees six shared items.
App registration has User.Read and Files.ReadWrite.All scopes (admin consent granted).

The security team doesn't want to add Sites.Read.All scope for security purpose (i agree with them).
BTW, this worked correctly until ~two weeks ago (six shared items was returned); no configuration or code changes were made on our side since then.

We tried to investigate, but the configurations seems all ok.

The first time we encounter this issue was on 28th of October 2025 (on 27th all worked as expected). Some days after, it returned to work properly, and now it's around 1 week that the issue has returned.

Are there known limitations or behavioral differences for /me/drive/sharedWithMe when the token is obtained via ROPC (delegated) vs interactive login or Graph Explorer?

Are additional scopes, delegated permissions, or admin consents required to enumerate all items visible in the OneDrive UI when authenticating with ROPC (if i look at document page the answer is no, but maybe something changed)?

Can sharedWithMe results depend on browser/session signals, cached indexing, or transient metadata that Graph Explorer/OneDrive UI use but ROPC-based API calls do not?

Any other ideas?

Microsoft Security | Microsoft Graph
{count} votes

1 answer

Sort by: Most helpful
  1. Q&A Assist
    2025-11-11T17:26:44.11+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    It appears that you are experiencing inconsistencies with the /me/drive/sharedWithMe endpoint when using the ROPC (Resource Owner Password Credentials) flow. Here are some points to consider regarding your situation:

    1. Behavioral Differences: The behavior of the /me/drive/sharedWithMe endpoint may vary based on the authentication method used. ROPC does not provide the same context as an interactive login, which could lead to differences in the items returned. The Graph Explorer and OneDrive UI may utilize additional session information or caching mechanisms that are not available in ROPC.
    2. Permissions: While you have the User.Read and Files.ReadWrite.All permissions, it is important to note that certain permissions may be required to access specific shared items. Although the documentation suggests that additional permissions should not be necessary, changes in the API or underlying data structures could affect this behavior.
    3. Caching and Indexing: The results from the Graph API can indeed be influenced by caching and indexing. The OneDrive UI and Graph Explorer might have access to cached data or metadata that is not reflected in API calls made via ROPC, potentially leading to discrepancies in the number of items returned.
    4. Transient Issues: Since you mentioned that this issue has appeared intermittently, it is possible that there are transient issues with the Graph API or the underlying services that may affect the results returned. Monitoring for patterns or specific conditions when the issue arises could provide further insights.
    5. Consideration for Additional Scopes: While your security team is cautious about adding Sites.Read.All, it may be worth discussing the implications of this permission in the context of your application's functionality. If the shared items are stored in a way that requires this permission, it may be necessary to revisit this decision.

    In summary, the differences in behavior you are observing could stem from the nature of ROPC authentication, potential caching mechanisms, and the specific permissions granted to your application. It may be beneficial to test with different authentication methods or to consult the Microsoft Graph documentation for any recent changes that could impact the API's behavior.


    References:

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.