Sep 29 2021 11:43 AM
As the subject says, I am trying to upload a file to SharePoint Online Documnet library.
I created AAD App and given Site.FullControl.All on my test lab tenant. I am able to generate oAuth Token but whenever I try to trigger the Invoke-RESTMethod it throws 403 error.
$Uri = #$Uri = "https://graph.microsoft.com/v1.0/drives/$driveId/items/root:/test45.docx:/content"
Invoke-RestMethod -Uri $Uri -Headers $headers -Method Put -Body $path.OpenRead() -ContentType "application/docx"
I tested the end point using the token available in Graph Explorer and it works fine.
Any help.
Thanks
Aniruddha
Sep 29 2021 11:44 AM