$ErrorActionPreference = 'Stop'
try {$headers = @{ Authorization = '%AuthHeader%' }
$uri = 'https://graph.microsoft.com/v1.0/sites/sreekanth10.sharepoint.com/drive/root:/reports/invoice_001_TechSolutions.pdf:/content'
$resp = Invoke-RestMethod -Method Put -Uri $uri -Headers $headers -ContentType 'application/pdf' -InFile 'C:\Users\usree\Downloads\Reports\invoice_001_TechSolutions.pdf'
Write-Output ('UPLOADED: ' + $resp.webUrl)
} catch {
Write-Output ('FALLBACK FAILED: ' + $_.Exception.Message)
}
=======================
File.ConvertToBinary File: $'''C:\\Users\\usree\\Downloads\\Reports\\invoice_001_TechSolutions.pdf''' BinaryData=> BinaryData
Web.InvokeWebService.InvokeWebServicePutUpload Url: $'''https://graph.microsoft.com/v1.0/sites/mysite.sharepoint.com/drive/root:/reports/invoice_001_TechSolutions.pdf:/content''' Accept: $'''application/json''' CustomHeaders: $'''Authorization: %AuthHeader%''' ConnectionTimeout: 30 FollowRedirection: True ClearCookies: False FailOnErrorStatus: False EncodeRequestBody: False UserAgent: $'''Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.21) Gecko/20100312 Firefox/3.6''' Attachments: { ^['NAME', 'ATTACHMENT', 'TYPE'], [$'''invoice_001_TechSolutions.pdf''', $'''C:\\Users\\usree\\Downloads\\Reports\\invoice_001_TechSolutions.pdf''', $'''FilePath'''] } Encoding: Web.Encoding.AutoDetect AcceptUntrustedCertificates: False UploadType: Web.UploadType.FilePath TrimRequestBody: False ResponseHeaders=> WebServiceResponseHeaders Response=> WebServiceResponse StatusCode=> StatusCode
https://graph.microsoft.com/v1.0/sites/sreekanth10.sharepoint.com:/sites/hr:/drive/root:/reports/invoice_001_TechSolutions.pdf:/content
https://graph.microsoft.com/v1.0/sites/sreekanth10.sharepoint.com:/sites/hr:/drive/root:/reports/invoice_001_TechSolutions.pdf:/content
==========================
No comments:
Post a Comment