Skip to content

drv$list_shared_items() returns list of ms_object and not list of ms_drive_items #206

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

Closed
mstackhouse opened this issue Mar 26, 2024 · 20 comments

Comments

@mstackhouse
Copy link

Currently I'm trying to access shared a shared folder, so in order to find the shared folder item I'm using the method drv$list_shared_items(). The list that's returned is a list of ms_object objects.

Prior to version, I could use that item directly to access files from within the shared folder using folder_item$get_item("path"), but now that the items are classed as ms_object the get_item() method is not available.

In the documentation, it states:

Because of how the Graph API handles access to shared items linked in the root, you cannot directly access subitems of shared folders via the drive get_item method, like this: drv$get_item("shared_folder/path/to/file"). Instead, get the item into its own object, and use its get_item method: drv$get_item("shared_folder")$get_item("path/to/file")

Unfortunately I can't get this to work, because:

  • I can't find an applicable way to enter the "shared_folder" path, because any path that I provide is pointing into my own OneDrive folder as the root path, and
  • I can't find any ItemID within the ms_object properties that is accessible using drv$get_item(). Any ID that I try returns a 404.
@mstackhouse
Copy link
Author

mstackhouse commented Apr 3, 2024 via email

@dcomputing
Copy link

I think you just sent this via a reply to the email, but just an FYI this didn't update as a comment on the GitHub issue itself: #206

Sorry, I deleted the comment I had posted. The code I was dealing with depended on the previous data frame table that had the properti isDir set. I have yet to work out how to handle 2.4.0's list_share_items output. I thought I could call the ms_drive_item's is_folder function but as you say, it is not a list of ms_drive_items.

@awosoga
Copy link

awosoga commented Sep 27, 2024

Experiencing this issue as well, has a workaround been proposed yet?

@3styleJam
Copy link

@mstackhouse I have also come across this issue, which is preventing me from accessing files which are shared with me.

@eitsupi , @r-ash , @datawookie , @msberends and @stephenashton-dhsc , I hope one or more of you will be able to help as contributors to this package and currently active GitHub members. It seems that @hongooi73 , the main contributor of this package, has been inactive for over a year and as a result open issues including this one have been piling up. When you have a free moment, please can you take a look at some of the recent issues including this one and see if we can resolve them? My experience in building/maintaining packages and time is limited, but I am happy to offer my assistance. Thank you.

@msberends
Copy link
Contributor

Sure, I’d like to help - but if @hongooi73 is not available to merge PR’s, how will this package progress? Including releases on CRAN?

@stephenashton-dhsc
Copy link
Contributor

I probably won't be able to provide too much support - whilst I am reasonably okay with package development, I'm not skilled enough with the underlying API interface.

For package progress, I'm assuming that @hongooi73 or someone within the Azure organisation will have to change permissions to allow for a wider number of individuals to merge PRs. For releases on CRAN, I believe the standard process is for the current author to email CRAN formally passing authorship to another named individual.

@3styleJam
Copy link

Thank you @msberends and @stephenashton-dhsc for your quick responses. I am not sure who the appropriate point of contact would be in the Azure organisation if @hongooi73 is unavailable, may require a general enquiry. What happens if an author of a package is unavailable and therefore unable to formally pass authorship? Is there a process where ownership can be transferred, or failing that grant merge (or other) permissions to other trusted contributors?

@stephenashton-dhsc
Copy link
Contributor

For CRAN, their requirement is to "explain any change in the maintainer’s email address and if possible send confirmation from the previous address (by a separate email to [email protected]) or explain why it is not possible."

I haven't gone through this process myself, but some of it may depend on why the transfer is occurring (e.g. if @hongooi73 is no longer part of Microsoft).

Regarding reaching out to Azure, it appears as though they list the contact address for the organisation as [email protected].

@hongooi73
Copy link
Collaborator

Hello all, apologies for the non-response, I've been dealing with some personal issues. I'll be looking at the accumulated issues over the next few days and merging/fixing as required. Sorry again for not being able to get this done before.

@hongooi73
Copy link
Collaborator

hongooi73 commented Feb 6, 2025

Fixing shared files is difficult for me, as I don't have access to a business MS365 account (as far as I know, everything works with a personal account). Can someone who has a business account share a file for testing purposes?

@mstackhouse
Copy link
Author

@hongooi73 if you give me an account name I'm happy to share a file with you. You can send to [email protected] and I'll reach out from my business account.

@hongooi73
Copy link
Collaborator

@mstackhouse I've just sent you an email. Thanks!

@hongooi73
Copy link
Collaborator

Just to clarify, is this problem occurring with the CRAN version of the package, or the dev version on Github?

@3styleJam
Copy link

Just to clarify, is this problem occurring with the CRAN version of the package, or the dev version on Github?

I am experiencing this problem on the CRAN version, can't speak for the dev version as I haven't tried it.

@hongooi73
Copy link
Collaborator

Please try the Github version, as it makes changes to the shared object code.

@hongooi73
Copy link
Collaborator

Hmm.. it looks like Business OD/SP files shared with a personal account don't show up in the listing 🤔

@3styleJam
Copy link

Hmm.. it looks like Business OD/SP files shared with a personal account don't show up in the listing 🤔

I have tried the GitHub version, connected to a Business OneDrive and ran drv$list_shared_items(). I have then used drv$list_shared_items()[[i]] to grab the ith item, and drv$list_shared_items()[[i]]$download() successfully downloads the file. This is something I could not do on the CRAN version because there was no download method.. Also note that in my attempt I chose a file that was shared with me from another Business OneDrive, so I am not sure why it wouldn't work with a file shared from a Personal OneDrive.

@hongooi73
Copy link
Collaborator

What I mean is that on my personal MS365 account, the files that people have shared with me from a business account don't show up. But it sounds like the Github version fixes the issue of list_shared_items returning incorrect object types, is this correct?

@3styleJam
Copy link

What I mean is that on my personal MS365 account, the files that people have shared with me from a business account don't show up. But it sounds like the Github version fixes the issue of list_shared_items returning incorrect object types, is this correct?

Correct. The CRAN version returns R6 objects of class ms_object only (which does not have the download or get_item methods), while the GitHub version returns R6 objects of ms_drive_item and ms_object and those do have download, get_item and presumably the other methods expected for the ms_drive_item class. @mstackhouse please can you test your original code again with the GitHub version of Microsoft365R and let us know if it works or not?

@hongooi73
Copy link
Collaborator

I'm going to mark this as done. If people are still experiencing problems, feel free to reply to this thread.

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

No branches or pull requests

7 participants