I'm trying to write a binary file from an Azure storage account to a SharePoint document library using Azure Data Factory. I'm using an Azure Python Function to get the bytes for the file and the size of the file in bytes. I'm able to to get the upload session, which causes the Items count in the library to actually increase each time but there are no files visible.
I've also tried in Postman by attaching a binary file locally and I get the same error message.
Create Upload Session (works)
{
"url": "https://graph.microsoft.com/v1.0/drives/xxxxxxxxxxxxxxxxxxxxxxxxxxx/items/xxxxxxxxxxxxxxxxxxxxxxxxxxx/360140.pdf:/createUploadSession",
"method": "POST",
"headers": {
"Content-Type": "application/json",
"Authorization": "Bearer xxxx"
},
"body": "{\n\t'microsoft.graph.conflictBehavior': 'replace',\n\t'fileSize': '631024',\n\t'name': '360140.pdf'\n},'deferCommit': false"
}
Writing file to SharePoint with the URL created from createUploadSession fails.
{
"url": "https://xxxxx.sharepoint.com/sites/Test/_api/v2.0/drives/xxxxx/items/xxxxx/uploadSession?guid='88b41b1c-5ed9-4c1d-8fac-ed9123079188'&overwrite=True&rename=False&dc=0&tempauth=eyJ0eX.....",
"method": "PUT",
"headers": {
"Authorization": "Bearer xxxx",
"Content-Length": "631024",
"Content-Type": "application/octet-stream"
},
"body": <the byte data>,
"disableCertValidation": true,
"httpRequestTimeout": "00:05:00"
}
Error Message
Error calling the endpoint 'https://xxxxx.sharepoint.com'. Response status code: 'NA - Unknown'. More details: Exception message: 'NA - Unknown [ClientSideException] An error occurred while sending the request.'.
Request didn't reach the server from the client. This could happen because of an underlying issue such as network connectivity, a DNS failure, a server certificate validation or a timeout.