-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error 400 during put on drive item #736
Comments
Hello @PrzemyslawSagalo thanks for using the SDK and for raising this. What is the requestInformation, does it set the apprpriate content headers. prior to sending the request, you might consider setting the request information object https://github.com/microsoft/kiota-abstractions-python/blob/main/kiota_abstractions/request_information.py Then use that request information object for the request e.g to upload an item to drive? Is the intention to upload an item to drive item https://learn.microsoft.com/en-us/graph/api/driveitem-put-content?view=graph-rest-1.0&tabs=http or to update the properties of a drive item https://learn.microsoft.com/en-us/graph/api/driveitem-update?view=graph-rest-1.0&tabs=http? |
Hi @shemogumbe thank you for your quick response.
proxies = {"http": "http://my-proxy.com:80", "https": "http://my-proxy.com:443"}
tenant_id = "tenant_id_value"
client_id = "client_id_value"
credentials = DeviceCodeCredential(client_id=client_id, tenant_id=tenant_id, proxies=proxies)
scopes = ["Files.ReadWrite.All"]
auth_provider = AzureIdentityAuthenticationProvider(credentials, scopes=scopes)
httpx_proxies = {
"http://": proxies["http"],
"https://": proxies["https"],
}
http_client = AsyncClient(proxies=httpx_proxies)
http_client = GraphClientFactory.create_with_default_middleware(client=http_client)
request_adapter = GraphRequestAdapter(auth_provider, http_client)
client = GraphServiceClient(request_adapter=request_adapter)
|
@shemogumbe The exception message could be more intuitive because it does not accurately convey the actual problem. |
@PrzemyslawSagalo I had your same problem using almost the same code, and after fixing the
Did you happen to solve this too? My code is:
What can I try to solve this? @shemogumbe Thank you. |
Solved, there was a missing |
Describe the bug
I am trying to upload a .docx file into OneDrive using Graph API. Unfortunately, it returns an error 400.
Expected behavior
Based on the type from the code of the sdk passed type is correct, so I don't understand this behaviour and the bellow code should upload the file.
How to reproduce
SDK Version
1.4.0
Latest version known to work for scenario above?
No response
Known Workarounds
No response
Debug output
Click to expand log
```The text was updated successfully, but these errors were encountered: