Upload Large Files To OneDrive Using Microsoft Graph API In Python

Поділитися
Вставка
  • Опубліковано 10 гру 2024
  • In this tutorial, I will cover how to upload large files to OneDrive using Microsoft Graph API in Python.
    📑 ms_graph.py Source Code: learndataanaly...
    📑 OneDrive Documentation Reference:
    docs.microsoft...
    📑 OneDrive Upload Large File Documentation:
    docs.microsoft...
    📺 Getting Started With Microsoft Graph API In Python (Set Up & Authentication):
    • Getting Started With M...
    📺 How To Create Access Token To Microsoft Graph API In Python:
    • How To Create Access T...
    📺 How To Save Microsoft Graph API Token In A Token File:
    • How To Save Microsoft ...
    ► Buy Me a Coffee? Your support is much appreciated!
    -------------------------------------------------------------------------------------------
    ☕ Paypal: www.paypal.me/...
    ☕ Venmo: @Jie-Jenn
    💸 Join Robinhood with my link and we'll both get a free stock: bit.ly/3iWr7LC
    ► Support my channel so I can continue making free contents
    ---------------------------------------------------------------------------------------------------------------
    🌳 Becoming a Patreon supporter: / jiejenn
    🛒 By shopping on Amazon → amzn.to/2JkGeMD
    📘 Facebook Page → / madeinpython
    📘 More tutorial videos on my website → LearnDataAnaly...
    ✉️ Business Inquiring: UA-cam@LearnDataAnalysis.org
    #OneDrive #OneDriveAPI #MicrosoftGraphAPI #MSGraphAPI

КОМЕНТАРІ • 35

  • @pernulfo
    @pernulfo Рік тому

    Excellent, very good way to teach how to use the API. All work very well. For me, the hard part was create the API on AZURE, my account had a issue with Chrome. Instead I used Edge and work 100%.

    • @jiejenn
      @jiejenn  Рік тому

      I had the same issue with Chrome as well.

  • @BravoDesmond
    @BravoDesmond 2 роки тому +2

    I'm a little confused about GRAPH_API_ENDPOINT, how do I get that

  • @simmonslucas
    @simmonslucas Рік тому

    Good stuff. Thanks, young man.

  • @rajaravi1037
    @rajaravi1037 2 роки тому +1

    When I try to upload the file of size 2.5MB using Postman I get an error like ,
    {
    "error": {
    "code": "invalidRequest",
    "message": "The Content-Range header is missing or malformed."
    }
    }

    • @jiejenn
      @jiejenn  2 роки тому

      You may want to use the regular upload function.
      ua-cam.com/video/Ok8O_QnrSBI/v-deo.html

    • @rajaravi1037
      @rajaravi1037 2 роки тому

      @@jiejenn Thanks for the reply. I sorted the issue. But it will be really helpful if we can have this demo or samples in nodejs..

    • @jiejenn
      @jiejenn  2 роки тому

      I don't know JavaScript.

  • @StanislavGorchakov
    @StanislavGorchakov 2 роки тому

    Is it possible to do this stuff in async way? I used asyncio + aiohttp and have that error
    aiohttp.client_exceptions.ClientResponseError: 416, message='Requested Range Not Satisfiable'

  • @ipad9075
    @ipad9075 Рік тому

    Thanks for useful video! My code stopped in chunk_data = upload.read(chunk_size) with error "ValueError: read of closed file". How can I solve this?

  • @sris3166
    @sris3166 2 роки тому +1

    Hi, If possible can you please make a video on creating upload session for attaching large attachments to outlook using ms graph

  • @abhijitbansode9324
    @abhijitbansode9324 Рік тому

    Nice explanation. Wondering if the process would be same to upload to a SharePoint folder instead of OneDrive folder.

  • @Vivi-mq5uz
    @Vivi-mq5uz Рік тому

    Thanks for the author's sharing. Watching the author's video on Microsoft Graph api is very helpful to me, and I would like to ask what I should do if I want to upload the whole directory?

    • @Vivi-mq5uz
      @Vivi-mq5uz Рік тому

      maybe my describe not accurate ,i would like say upload a folder

  • @cl88888
    @cl88888 Рік тому

    Great one! BTW, would you know the API to create "request file" of a folder in OneDrive for Business?

    • @jiejenn
      @jiejenn  Рік тому

      Not sure what request file is.

    • @cl88888
      @cl88888 Рік тому

      @@jiejenn "Request files" link can be generated manually by right-click on a folder and select "request files" option in the context menu. I'd like to know if there's a way to generate this link via Graph API.

  • @yashodiptakore7599
    @yashodiptakore7599 Рік тому +1

    Where to get app id?

  • @elaia929
    @elaia929 2 роки тому

    Does Microsoft Graph API allow download of a file inside a folder?

    • @jiejenn
      @jiejenn  2 роки тому +1

      Of course. The tutorial how to download a file is actually going to be uploaded later today.

  •  2 роки тому +1

    great tut, thanks ad

  • @abdulkhalik759
    @abdulkhalik759 2 роки тому

    In java actual byte array lengths sent to server exceeds the chunk size. Never able to make it success😭

    • @jiejenn
      @jiejenn  2 роки тому

      I am not experienced with Java, so can't help you there.

    • @abdulkhalik759
      @abdulkhalik759 2 роки тому +1

      @@jiejenn I have achieved it, my issue was related to byte array encoding. Thank you.

    • @amitkikraft5687
      @amitkikraft5687 2 роки тому

      @@abdulkhalik759 Can you help me to fix this issue? I got error like The Content-Range header length does not match the provided number of bytes. with my java code.

    • @abdulkhalik759
      @abdulkhalik759 2 роки тому

      @@amitkikraft5687 there is a particular way how you need to calculate ranges, share your sample code.

  • @simonebollati5285
    @simonebollati5285 2 роки тому +1

    is it possible to avoid the browser authentication part? my purpose would be to schedule a script that uploads a file every day forever, but once activated I have no way to access the machine. How could I do ? thanks

    • @jiejenn
      @jiejenn  2 роки тому

      This is something I still haven't figure it out. I would like to know the answer too.

    • @chrisgreening9313
      @chrisgreening9313 2 роки тому

      Hey Simone! I have a very similar usecase - I got it to work by adding offline_access to the scopes. You only have to go through the browser authentication once and the token response will include both an access token AND a long-lived refresh token which you can then persist and use for subsequent access token refreshes.
      Additional information: docs.microsoft.com/en-us/azure/active-directory/develop/v2-permissions-and-consent

    • @StanislavGorchakov
      @StanislavGorchakov 2 роки тому +1

      @@jiejenn Yes, it is possible to do when you choose Api Permissions for application as Application in Azure. After that you don't need to use authentication part

    • @Capsonfernandes
      @Capsonfernandes Рік тому

      @@StanislavGorchakov Do you have any helpful links that may allow me to do this?

  • @mrblackdevil4283
    @mrblackdevil4283 Рік тому

    How to upload 2GB file to One Drive ?

    • @jiejenn
      @jiejenn  Рік тому +1

      Isn't that's what the video is for?