-
Notifications
You must be signed in to change notification settings - Fork 142
Accessing Special.AppRoot-Folders of other onedrive users #180
Comments
I am unable to repro your issue. Using v2.0.2, I executed this query: var expandValue = "thumbnails,children";
folder = await this.oneDriveClient.Drives[$"{userId}"].Items[$"{userId}!{itemId}"]
.Request().Expand(expandValue).GetAsync(); That returned the expected set of files. Are you sure that you have the correct userId and itemId? Are you sure you have permissions to that item? About #147, you are right is still outstanding. Will be fixed in the next version of the SDK, which should be out this week. |
Yes, I'm sure that I use the correct userId and ItemId (the ItemId is a combination of the DriveID + "!" + ItemID). Also, I have permissions to the folder because I'm able to open it over the IOneDriveSharesCollectionRequestBuilder:
This Folder is a Subfolder of a WindowsUWP-Application, which I have created before with the account of User A:
After that I logon with the account of User B over the WebUrl which I retrieved previously with permissionResult**.Link.WebUrl**.
// 2. I wan't to open it with the resolved OneDriveID (which is excatly the same), and this doesn't work. Also I can't up- and download files in this subfolder. Maybe, it has something to do with the Special.AppRoot??? |
I investigated the problem and I found out that it has nothing to do with the Special.AppRoot-Folder but with the Microsoft.Graph.Core-Library. Then I tested to download a file from this folder with IOneDriveSharesCollectionRequestBuilder and the Pathname:
Here I also get a Microsoft.Graph.ServiceException when the GetAsync()-method is invoked in the ItemContentRequest-Class where it invokes the SendStreamRequestAsync()-Method in line 53. The interesting thing is that I'm able to open and download files from my Application-Folder through a Web-Browser with same Request-URL which generates the sdk-Request-Interfaces!! (https://api.onedrive.com:443/v1.0/shares/u!..encodedUrl../root:/..filename..:/content). @cdmayer : Can you please tell me why the Microsoft.Graph.Core-Library doesn't allow this scenario? |
Hello Chris, are the code-snippets, which I posted two days ago, enough for you, to reproduce this issue – or do you need my complete code? -Damir Von: Chris Mayer [mailto:[email protected]] I am unable to repro your issue. Using v2.0.2, I executed this query: var expandValue = "thumbnails,children"; folder = await this.oneDriveClient.Drives[$"{userId}"].Items[$"{userId}!{itemId}"]
That returned the expected set of files. Are you sure that you have the correct userId and itemId? Are you sure you have permissions to that item? About #147#147, you are right is still outstanding. Will be fixed in the next version of the SDK, which should be out this week. — |
Hello Damir, Thank you for pointing out the discrepency in dependencies. I will update that shortly. I was unable to reproduce your issue. I used the exact same request chain (pointing at a shared folder) and was able to successfully get a file stream. I am not sure what issue you're running into. Can you try to gather more information about circumstances where the issue can be reproduced? |
Hi Chris, thank you for your help. I really don’t know what else I can tell you. I have a Windows-UWP-Application. I create the OneDrive-Client on this way:
The Client-ID is a string with 16 characters which I have from the Application-Registration-Portal at https://apps.dev.microsoft.com/#/appList. The first user who creates the shared folder has an account at the microsoft domain „[email protected]“. If this informations doesn’t help you, I can send you my Visual-Studio-Project and explain you how you can reproduce the issue. -Damir Von: Chris Mayer [mailto:[email protected]] Hello Damir, Thank you for pointing out the discrepency in dependencies. I will update that shortly. I was unable to reproduce your issue. I used the exact same request chain (pointing at a shared folder) and was able to successfully get a file stream. I am not sure what issue you're running into. Can you try to gather more information about circumstances where the issue can be reproduced? — |
|
Yes I did that. I described it a few days ago at microsoftgraph/msgraph-sdk-dotnet#59 Von: Chris Mayer [mailto:[email protected]]
— |
Hi Chris, I use CredentialVault-Class to cache the session, so that the user doesn't have to log on again after he has closed and started the UWP-Application:
In your examples/documentation you use "https://api.onedrive.com/v1.0" and "https://login.live.com/oauth20_desktop.srf" is that right or must be used other url's for my scenario? There must be a problem in the combination Cached Sessions + Http-Redirection + Onedrive-API-Version. Please help me! |
I have found out the problem, and this is definitively a bug.
So long as one of those points are not fixed, a sharing scenario for Applications using onedrive-sdk-csharp is not possible. |
A small apostil: |
I have implemented the Invitation-Logic and commited to the Invitation-Branch. |
I know now why: |
Thank you for reaching out and for your patience. This SDK is being officially deprecated. See #259 for more information |
Since the change to to Graph.Core (Version 2.0.2) the access to a shared folder of another onedrive user doesn't work anymore.
I wan't to access the folder over
var request = _OneDriveClient.Drives[OneDriveID]
.Items[OneFolderRequestID]
.Request()
.Expand("children");
but the request ends in a Microsoft.Graph.Exception:
at Microsoft.Graph.HttpProvider.d__19.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Graph.BaseRequest.d__34.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Graph.BaseRequest.d__32
1.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.OneDrive.Sdk.ItemRequest.<GetAsync>d__6.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter
1.GetResult()at HandballReporter.shared.ViewModel.DivisionViewModel.d__53.MoveNext()
When I'm authenticated with the user who owns this shared folder, the request works without any problems.
According to the One-Drive-documentation at https://dev.onedrive.com/misc/working-with-links.htm the IDriveItemsCollectionRequestBuilder builds the correct RequestURL:
https://api.onedrive.com:443/v1.0/drives/123456789.../items/123456789...!54321
Also I'm not possible to download or upload files to a shared folder of another user in this way.
Three months ago I'have opened another issue (147) which concerns the access to shared contents also. Generally, it seems that the access to shared contents doesn't work properly.
@cdmayer : Please take some time to investigate and fixe this bugs, or can I somehow help you ?
The text was updated successfully, but these errors were encountered: