Forum Discussion
Explicitly sharing files externally
Requirement: Let user A (in tenant/org Y) share a file with user B (in tenant/org Z) and allow user B to access or copy this file to their storage programmatically.
Can this be achieved? I have tried the following -
"/copy" endpoint with either user's authentication results in 404 error - The resource could not be found.
"/invite" endpoint with user A's authentication, then "/sharedWithMe?allowexternal=true" with user B's authentication - does not list the shared file.
2 Replies
- Use /invite or createLink to share the file from User A (Tenant Y) with User B (Tenant Z).
- Authenticate User B against Tenant Y (as a B2B guest) and access the file via the /shares/{shareId} API.
- Download the file, then upload it to User B's OneDrive in Tenant Z.
- Cross-tenant /copy is not supported, and sharedWithMe is not recommended for this scenario.
I believe yes, cross‑tenant file sharing and programmatic access are supported by Microsoft Graph, but only through the driveItem: invite and sharedWithMe endpoints with proper delegated permissions and external sharing enabled in both tenants. The /copy endpoint cannot operate across tenants, which explains your 404 error.