Open ForerunnerG34 opened 4 years ago
I've got the same error when trying to up version of Microsoft.Graph and Microsoft.Graph.Core libraries. It looks like Microsoft.OneDriveSDK works only with Microsoft.Graph/Microsoft.Graph.Core 1.12.0.
I've investigated why this happened. That's because new implementation of Microsoft.Graph.BaseRequest does not contain this property:
// Summary:
// Gets or sets the telemetry header prefix for requests.
protected string SdkVersionHeaderPrefix
{
get;
set;
}
And in Microsoft.OneDrive.Sdk.ItemRequest ctor we can see this code:
this.SdkVersionHeaderPrefix = "onedrive";
I'm using Microsoft.Identity to sign in into MS Graph and obtain an object of IPublicClientApplication. Scopes: "Files.ReadWrite.AppFolder", "Files.Read.All"
Then I'm trying to read any folder from OneDrive, for example the AppFolder:
IntegratedWindowsAuthenticationProvider authenticationProvider = new IntegratedWindowsAuthenticationProvider(PublicClientApp, scopes); var oneDriveClient = new OneDriveClient(authenticationProvider); var rootItem = await oneDriveClient.Drive.Special.AppRoot.Request().GetAsync(); // throws exception
And it throws this exception:
System.MissingMethodException HResult=0x80131513 Message=Method not found: 'Void Microsoft.Graph.BaseRequest.set_SdkVersionHeaderPrefix(System.String)'. Source=Microsoft.OneDrive.Sdk StackTrace: at Microsoft.OneDrive.Sdk.ItemRequest..ctor(String requestUrl, IBaseClient client, IEnumerable
1 options) at Microsoft.OneDrive.Sdk.ItemRequestBuilder.Request(IEnumerable
1 options) at Microsoft.OneDrive.Sdk.ItemRequestBuilder.Request()