We are trying to implement integration between a web application and SharePoint Online using Microsoft Graph rest API.
Specifically, we need to upload a file to a specific SharePoint site's document library (drive), different than current user default drive. We get the access token through Azure AD with access to all files.
We can upload files into any drive using /v1.0/me/drive/...
but not when we use another drive.
For example:
var response = client.PutAsync(graphResourceUrl +
"/beta/sharepoint/sites/" + siteCollSiteId +
"/lists/" + listId +
"/drive/root/children/" + fileName + ":/content",
new ByteArrayContent(fileBytes)).Result;
var response = client.PutAsync(graphResourceUrl +
"/beta/drives/" + "/" + listId +
"/items/" + siteCollSiteId + "/" + fileName + ":/content",
new ByteArrayContent(fileBytes)).Result;
var response = client.PutAsync(graphResourceUrl +
"/beta/drives/" + listId + "/" + fileName + ":/content",
new ByteArrayContent(fileBytes)).Result;
Both /v1.0
and /beta
(in the case of SharePoint containing path) we are getting an error response of Not Implemented
.
What could we be doing wrong? Is it not yet working with Microsoft Graph (other than /me
)?