René's URL Explorer Experiment


Title: Cannot upload PDF file to OneDrive, unclear API Error · Issue #869 · microsoftgraph/msgraph-sdk-python · GitHub

Open Graph Title: Cannot upload PDF file to OneDrive, unclear API Error · Issue #869 · microsoftgraph/msgraph-sdk-python

X Title: Cannot upload PDF file to OneDrive, unclear API Error · Issue #869 · microsoftgraph/msgraph-sdk-python

Description: Describe the bug I am trying to upload a PDF file to OneDrive, but I receive a 400 APIError with an Invalid Request. Expected behavior Successful upload of the file. How to reproduce files = [item.name for item in await self._get_onedriv...

Open Graph Description: Describe the bug I am trying to upload a PDF file to OneDrive, but I receive a 400 APIError with an Invalid Request. Expected behavior Successful upload of the file. How to reproduce files = [item....

X Description: Describe the bug I am trying to upload a PDF file to OneDrive, but I receive a 400 APIError with an Invalid Request. Expected behavior Successful upload of the file. How to reproduce files = [item....

Opengraph URL: https://github.com/microsoftgraph/msgraph-sdk-python/issues/869

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Cannot upload PDF file to OneDrive, unclear API Error","articleBody":"### Describe the bug\r\n\r\nI am trying to upload a PDF file to OneDrive, but I receive a 400 APIError with an Invalid Request.\r\n\r\n### Expected behavior\r\n\r\nSuccessful upload of the file.\r\n\r\n### How to reproduce\r\n\r\n```python\r\n\r\nfiles = [item.name for item in await self._get_onedrive_items(\r\n    query_filter=\"file ne null and file/mimeType eq 'application/pdf'\"\r\n)]\r\n\r\nfolder_id_map = await self._get_folder_ids(source_folders)\r\n\r\nfor folder in source_folders:\r\n    folder_path = os.path.join('documents', folder)\r\n    if not os.path.exists(folder_path):\r\n        continue\r\n\r\n    for file_name in os.listdir(folder_path):\r\n        if file_name in files:\r\n            continue\r\n\r\n        file_path = os.path.join(folder_path, file_name)\r\n\r\n        with open(file_path, 'rb') as file:\r\n            file_content = file.read()\r\n\r\n        folder_id = folder_id_map.get(folder)\r\n        if not folder_id:\r\n            print(f\"Folder ID for '{folder}' not found.\")\r\n            continue\r\n\r\n        parent_reference = ItemReference(\r\n            id=folder_id\r\n        )\r\n\r\n        drive_item = DriveItem(\r\n            name=file_name,\r\n            file=File(),\r\n            parent_reference=parent_reference,\r\n            content=file_content\r\n        )\r\n\r\n        try:\r\n            response = await self._user_client.drives.by_drive_id(\r\n                os.getenv('ONEDRIVE_DEV_DRIVE_ID')\r\n            ).items.post(drive_item)\r\n\r\n            print(\"Response\", response)\r\n        except Exception as e:\r\n            print(f\"Failed to upload file '{file_name}': {e}\")\r\n\r\n```\r\n\r\n### SDK Version\r\n\r\nmsgraph-core~=1.1.2 msgraph-sdk~=1.5.3\r\n\r\n### Latest version known to work for scenario above?\r\n\r\n_No response_\r\n\r\n### Known Workarounds\r\n\r\n_No response_\r\n\r\n### Debug output\r\n\r\n\u003cdetails\u003e\u003csummary\u003eClick to expand log\u003c/summary\u003e\r\n```\r\n\r\nAPIError\r\n        Code: 400\r\n        message: None\r\n        error: MainError(additional_data={}, code='invalidRequest', details=None, inner_error=InnerError(additional_data={}, client_request_id='13230f64-2c2e-4083-93c1-f7325291333c', date=DateTime(2024, 8, 22, 10, 12, 34, tzinfo=Timezone('UTC')), odata_type=None, request_id='f1815677-f808-46dd-af6d-7882803e975b'), message='Invalid request', target=None)\r\n\r\n```\r\n\u003c/details\u003e\r\n\r\n\r\n### Configuration\r\n\r\n- OS: Windows\r\n- architecture: AMD64\r\n\r\n### Other information\r\n\r\nThe 400 APIError could be more robust than just \"Invalid request\"","author":{"url":"https://github.com/Mirciulica15","@type":"Person","name":"Mirciulica15"},"datePublished":"2024-08-22T10:36:32.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":6},"url":"https://github.com/869/msgraph-sdk-python/issues/869"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:6f6d9772-c37c-4c7b-61d7-ec12776f0c89
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idE20A:6562C:75EF8:9F6AE:6969CF32
html-safe-nonce8045142e98525b05be625b8fcd20557758fdb022e9f8581aa57186f0caca59f0
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFMjBBOjY1NjJDOjc1RUY4OjlGNkFFOjY5NjlDRjMyIiwidmlzaXRvcl9pZCI6Ijg4NDcxMjE3MDY1MTM5NzcxMzgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmacd4cac3ee408a42642a714c361509de1b503115a2c6f5cc99890cf51b25ac375f
hovercard-subject-tagissue:2480444169
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/microsoftgraph/msgraph-sdk-python/869/issue_layout
twitter:imagehttps://opengraph.githubassets.com/aa9fa27ae7fc54364a9b71b2d02c110d7b62eff5a082f59df249f9f01c3291ff/microsoftgraph/msgraph-sdk-python/issues/869
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/aa9fa27ae7fc54364a9b71b2d02c110d7b62eff5a082f59df249f9f01c3291ff/microsoftgraph/msgraph-sdk-python/issues/869
og:image:altDescribe the bug I am trying to upload a PDF file to OneDrive, but I receive a 400 APIError with an Invalid Request. Expected behavior Successful upload of the file. How to reproduce files = [item....
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameMirciulica15
hostnamegithub.com
expected-hostnamegithub.com
Noneacedec8b5f975d9e3d494ddd8f949b0b8a0de59d393901e26f73df9dcba80056
turbo-cache-controlno-preview
go-importgithub.com/microsoftgraph/msgraph-sdk-python git https://github.com/microsoftgraph/msgraph-sdk-python.git
octolytics-dimension-user_id17304259
octolytics-dimension-user_loginmicrosoftgraph
octolytics-dimension-repository_id534665999
octolytics-dimension-repository_nwomicrosoftgraph/msgraph-sdk-python
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id534665999
octolytics-dimension-repository_network_root_nwomicrosoftgraph/msgraph-sdk-python
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release83c08c21cdda978090dc44364b71aa5bc6dcea79
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/microsoftgraph/msgraph-sdk-python/issues/869#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoftgraph%2Fmsgraph-sdk-python%2Fissues%2F869
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoftgraph%2Fmsgraph-sdk-python%2Fissues%2F869
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=microsoftgraph%2Fmsgraph-sdk-python
Reloadhttps://github.com/microsoftgraph/msgraph-sdk-python/issues/869
Reloadhttps://github.com/microsoftgraph/msgraph-sdk-python/issues/869
Reloadhttps://github.com/microsoftgraph/msgraph-sdk-python/issues/869
microsoftgraph https://github.com/microsoftgraph
msgraph-sdk-pythonhttps://github.com/microsoftgraph/msgraph-sdk-python
Notifications https://github.com/login?return_to=%2Fmicrosoftgraph%2Fmsgraph-sdk-python
Fork 84 https://github.com/login?return_to=%2Fmicrosoftgraph%2Fmsgraph-sdk-python
Star 562 https://github.com/login?return_to=%2Fmicrosoftgraph%2Fmsgraph-sdk-python
Code https://github.com/microsoftgraph/msgraph-sdk-python
Issues 89 https://github.com/microsoftgraph/msgraph-sdk-python/issues
Pull requests 17 https://github.com/microsoftgraph/msgraph-sdk-python/pulls
Discussions https://github.com/microsoftgraph/msgraph-sdk-python/discussions
Actions https://github.com/microsoftgraph/msgraph-sdk-python/actions
Projects 0 https://github.com/microsoftgraph/msgraph-sdk-python/projects
Security Uh oh! There was an error while loading. Please reload this page. https://github.com/microsoftgraph/msgraph-sdk-python/security
Please reload this pagehttps://github.com/microsoftgraph/msgraph-sdk-python/issues/869
Insights https://github.com/microsoftgraph/msgraph-sdk-python/pulse
Code https://github.com/microsoftgraph/msgraph-sdk-python
Issues https://github.com/microsoftgraph/msgraph-sdk-python/issues
Pull requests https://github.com/microsoftgraph/msgraph-sdk-python/pulls
Discussions https://github.com/microsoftgraph/msgraph-sdk-python/discussions
Actions https://github.com/microsoftgraph/msgraph-sdk-python/actions
Projects https://github.com/microsoftgraph/msgraph-sdk-python/projects
Security https://github.com/microsoftgraph/msgraph-sdk-python/security
Insights https://github.com/microsoftgraph/msgraph-sdk-python/pulse
New issuehttps://github.com/login?return_to=https://github.com/microsoftgraph/msgraph-sdk-python/issues/869
New issuehttps://github.com/login?return_to=https://github.com/microsoftgraph/msgraph-sdk-python/issues/869
Cannot upload PDF file to OneDrive, unclear API Errorhttps://github.com/microsoftgraph/msgraph-sdk-python/issues/869#top
https://github.com/Mirciulica15
Needs: Attention 👋https://github.com/microsoftgraph/msgraph-sdk-python/issues?q=state%3Aopen%20label%3A%22Needs%3A%20Attention%20%3Awave%3A%22
type:bugA broken experiencehttps://github.com/microsoftgraph/msgraph-sdk-python/issues?q=state%3Aopen%20label%3A%22type%3Abug%22
https://github.com/Mirciulica15
https://github.com/Mirciulica15
Mirciulica15https://github.com/Mirciulica15
on Aug 22, 2024https://github.com/microsoftgraph/msgraph-sdk-python/issues/869#issue-2480444169
Mirciulica15https://github.com/Mirciulica15
Needs: Attention 👋https://github.com/microsoftgraph/msgraph-sdk-python/issues?q=state%3Aopen%20label%3A%22Needs%3A%20Attention%20%3Awave%3A%22
type:bugA broken experiencehttps://github.com/microsoftgraph/msgraph-sdk-python/issues?q=state%3Aopen%20label%3A%22type%3Abug%22
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.