azure-active-directorymicrosoft-graph-apionedrive

Resource not found for segment 'root:' in onedrive graph api


While uploading doc to one drive programatically, i use the path "https://graph.microsoft.com/v1.0/users/%s/drive/root/%s:/content?@microsoft.graph.conflictBehavior=rename"

for example for a user a@company.com https://graph.microsoft.com/v1.0/users/a@company.com/drive/root:/Comparison%20of%20Value%20Added%20Benefits%20and%20Services:%20Humana%20vs%20AmeriHealth.docx:/content?@microsoft.graph.conflictBehavior=rename

i am seeing an error "Bad request: Resource not found for segment 'root:'"

As per docs https://learn.microsoft.com/en-us/onedrive/developer/rest-api/concepts/addressing-driveitems?view=odsp-graph-online this should be fine


Solution

  • It's definitely caused by : in file name after the Services

    Best solution would to remove : from Comparison of Value Added Benefits and Services: Humana vs AmeriHealth.docx