Graph API: Unable to access an external file shared with me

Stephan Methner 116 Reputation points
2021-02-20T10:10:19.55+00:00

Hi there,

@DanstanOnyango-6080

I want to access the OneDrive files that are shared with me. Even those from other tenants.

I'm running the call for files sharedWithMe with the flag "allowexternal=true". The result is a list of items.

All the files have a remoteItem with correct parentReference in it.

When I build a fileUrl based on this information this call is only working for the sender - but not for the receiver.

https://graph.microsoft.com/v1.0/drives/[parentReference.driveId]/items/[driveItem.id]

parentReference.driveId: b!WWpg2iE5G0eg5c8n4pIe1AH4UNNPmuNHmXLHxQW2L9QS2KywdKQ5RKdYB_W_3fIz

parentReference.id: 01DG3P2BN6Y2GOVW7725BZO354PWSELRRZ
driveItem.id: 01DG3P2BK7YAAQCKHOKZGKDIOYWHPYQKM7

I've used both id's... the id from parentReference... and the "driveItemId".

Is it not possible to access such an external file? In the next step I would like to read out Excel specific information from these files.

https://graph.microsoft.com/v1.0/drives/b!WWpg2iE5G0eg5c8n4pIe1AH4UNNPmuNHmXLHxQW2L9QS2KywdKQ5RKdYB_W_3fIz/items/01DG3P2BK7YAAQCKHOKZGKDIOYWHPYQKM7/driveItem/workbook/names.

Thanks a lot

0:  
@odata.type: "#microsoft.graph.driveItem"  
id: "01DG3P2BK7YAAQCKHOKZGKDIOYWHPYQKM7"  
lastModifiedDateTime: "2021-02-16T13:09:27Z"  
name: "Startup Reporting Sharing.xlsx"  
remoteItem:  
createdBy: {user: {…}}  
createdDateTime: "2021-01-09T23:50:34Z"  
file: {mimeType: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"}  
fileSystemInfo: {createdDateTime: "2021-01-09T23:50:34Z", lastModifiedDateTime: "2021-02-16T13:09:27Z"}  
id: "01DG3P2BK7YAAQCKHOKZGKDIOYWHPYQKM7"  
lastModifiedBy: {user: {…}}  
lastModifiedDateTime: "2021-02-16T13:09:27Z"  
name: "Startup Reporting Sharing.xlsx"  
parentReference: {driveId: "b!WWpg2iE5G0eg5c8n4pIe1AH4UNNPmuNHmXLHxQW2L9QS2KywdKQ5RKdYB_W_3fIz", driveType: "business", id: "01DG3P2BN6Y2GOVW7725BZO354PWSELRRZ"}  
shared: {scope: "users", sharedDateTime: "2021-01-09T23:55:09Z", sharedBy: {…}}  
sharepointIds: {listId: "b0acd812-a474-4439-a758-07f5bfddf233", listItemId: "58", listItemUniqueId: "0101c05f-ee28-4c56-a1a1-d8b1df88299f", siteId: "da606a59-3921-471b-a0e5-cf27e2921ed4", siteUrl: "https://netorgft6863818-my.sharepoint.com/personal/stephan_pipetrend_io", …}  
size: 255421  
webDavUrl: "https://netorgft6863818-my.sharepoint.com/personal/stephan_pipetrend_io/Documents/Startup%20Reporting%20Sharing.xlsx"  
webUrl: "https://netorgft6863818-my.sharepoint.com/personal/stephan_pipetrend_io/_layouts/15/Doc.aspx?sourcedoc=%7B0101C05F-EE28-4C56-A1A1-D8B1DF88299F%7D&file=Startup%20Reporting%20Sharing.xlsx&action=default&mobileredirect=true"  
__proto__: Object  
size: 255421  
webUrl: "https://netorgft6863818-my.sharepoint.com/personal/stephan_pipetrend_io/_layouts/15/Doc.aspx?sourcedoc=%7B0101C05F-EE28-4C56-A1A1-D8B1DF88299F%7D&file=Startup%20Reporting%20Sharing.xlsx&action=default&mobileredirect=true"  


  
Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
11,144 questions
{count} votes

Accepted answer
  1. Stephan Methner 116 Reputation points
    2021-02-22T18:14:22.497+00:00

    After digging a little bit deeper i found out that my main problem is not related to the "shared with me" query. I'm having some questions/problems relating driveItem-sharing, permissions from other tenants.

    You can close this question. I need to write a new one.

    Thanks a lot for your help

    Stephan


0 additional answers

Sort by: Most helpful