Skip to content

Support for getting item with OneDrive share link #839

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

Open
vinismarques opened this issue Sep 20, 2022 · 3 comments
Open

Support for getting item with OneDrive share link #839

vinismarques opened this issue Sep 20, 2022 · 3 comments

Comments

@vinismarques
Copy link

I was wondering if anyone could add support for getting drive items using a OneDrive share link.

This page in the documentation gives a little more detail: https://learn.microsoft.com/en-us/graph/api/shares-get?view=graph-rest-1.0&tabs=http

This way we could get the DriveItem and then download it, for example.

@williamhamilton
Copy link

@vinismarques Did you get this resolved?

@vinismarques
Copy link
Author

Hey @williamhamilton, I did find a workaround for the time being.

Check out this code. It is a library for Robot Framework, but you should be able to easily copy it to your own code, just bear in mind that self.client is an instance of O365.Account and you are good to go.

First, it encodes the shared URL using the function _encode_share_url and then uses a SharedItem class to add support for this new "type", since the original drive.File builds the wrong URL if used with shared items.

Hope this is helpful to you.

@williamhamilton
Copy link

@vinismarques Thanks. I will take a look.
I want to regularly upload/update files in a SharePoint folder, at the moment I am copying to a local folder which is shared to the user but this needs the user logged in to sync with OneDrive.

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

No branches or pull requests

3 participants