I am searching for ways to use the Microsoft Graph SDK for uploading a file to SharePoint. Currently I cannot find any example.
Has anyone tried to use the SDK for uploading file to SharePoint before? Thanks a lot.
I think I have found it. Yay! Praise God!
https://github.com/microsoftgraph/msgraph-sdk-dotnet/issues/208
In general, the structure of the SDK calling pattern mirrors the REST API. The path is built up by objects representing resources in the Graph API, then the request is composed (by explicitly invoking 'request'), and the verb is specified ("getAsync", "addAsync", "updateAsync").
For instance, something like GET ~/sites/<site id>/drives
would look like graphClient.Sites[<site id>].Drives.Request().GetAsync();
For creating resources, you first instantiate the resource and set any properties.
ListItem myListItem = new ListItem();
Then you build the request and specify the verb to be addAsync
ListItem responseItem = await graphClient.Sites[<site id>].Lists[<list id>].Items.Request().addAsync(myListItem);