Skip to content
This repository was archived by the owner on Aug 29, 2025. It is now read-only.
This repository was archived by the owner on Aug 29, 2025. It is now read-only.

create-upload-session is missing upload command #491

Open

Description

@dsrink

Is your feature request related to a problem? Please describe the problem.

I am trying to upload a large file in chunks.
Calling mgc with parameters
drives items create-upload-session post --drive-id DRIVE_ID --drive-item-id FILE_ID --body '{ "name": "TARGET_FILE_NAME", "file": {} }'
--> seems to work fine in my case, it yields a legitimate-looking uploadUrl (717 bytes of parameters, starting to count at "?guid=").

But I fail to find the way to use mgc to use that uploadUrl to upload the chunks of the large file.

Describe the solution you'd like.

Which part am I missing here? I assume that "mgc" is missing a command/mode to work with that uploadUrl.

If my assumption is correct, then this request is about adding such a command.

If my assumption is wrong, then this request is to provide details within this issue, and update the documentation accordingly.

Additional context?

When trying to use that uploadUrl with an external script (e.g. with python-requests), I am missing the authentication header / token which was created by "mgc login", therefore I get a HTTP 401 due to missing authentication. So this doesnt seem to be an option either.

Activity

  1. added
    status:waiting-for-triage
    type:feature
    on Jul 9, 2024
  2. andrueastman commented on Jul 10, 2024

    @andrueastman
    Contributor

    Thanks for raising this dsrink

    At the moment, the CLI does not support sending over file slices using Large File Upload requests similar to other SDKs at the moment with no immediate plans to do so. We'll keep this issue open to track the request to add support for this.

    When trying to use that uploadUrl with an external script (e.g. with python-requests). I am missing the authentication header / token which was created by "mgc login", therefore I get a HTTP 401 due to missing authentication. So this doesnt seem to be an option either.

    You should be able to use the URL with an external script as the docs explicitly state that the Auth header should not be included. Any chance you can confirm this again with the docs examples below?

    https://learn.microsoft.com/en-us/graph/api/driveitem-createuploadsession?view=graph-rest-1.0#remarks

  3. removed
    status:waiting-for-triage
    on Jul 10, 2024
  4. dsrink commented on Jul 11, 2024

    @dsrink
    Author

    thanks for informing. with your hint that uploadUrl needs no authentication, I invested more time into debugging. Turned out that my instance of python-requests found an outdated .netrc, and used that for authentication, which lead to sharepoint sending me a HTTP 401 Unauthorized. Removing that .netrc and it works.

    Nevertheless, while we are waiting (potentially many monthes or even a few years) for this request to be implenented: Is there really no way to do the sliced/chunked upload with mgc?
    One option I tried to explore (without success yet) was to use "mgc drive items content put" with some "--headers".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    ToTriagetype:feature

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions