Azure / Microsoft365R

R SDK for interacting with Microsoft 365 APIs
Other
308 stars 41 forks source link

Issue with downloading shared files. #189

Closed RealcoJaneZheng closed 5 months ago

RealcoJaneZheng commented 9 months ago

Hi! I found your package really handy but after I updated the package from version 2.3.4 to the latest version, seems I cannot properly download shared files anymore.

For example, if I want to download the first item of the shared files, this is what I did with version 2.3.4 and it worked very well. drv <- get_business_onedrive() drv$list_shared_items("items")[[1]]$download(dest = "test.csv", overwrite = TRUE)

After updating the package, this is what I did. drv <- get_business_onedrive() drv$list_shared_items()[[1]]$download(dest = "test.csv", overwrite = TRUE)

I can still successfully download a file, but the file is not the same as the original file. The original file is a csv file with a dataframe. However, this is a screenshot of a part of the file I downloaded.

Screenshot 2023-10-31 at 5 00 05 PM

Is this the correct way to download a shared file? Was there anything I did wrong? Thank you very much in advance for your help!

SHogenboom commented 8 months ago

@RealcoJaneZheng have you been able to find a workaround yet? I’m having the same issue and it’s rather inconvenient!

RealcoJaneZheng commented 8 months ago

@SHogenboom Unfortunately, I haven't found a workaround yet. I reinstalled version 2.3.4 to keep my application working for now.

SHogenboom commented 8 months ago

@RealcoJaneZheng Thanks! Might consider that as well. For now I created a shortcut to the parent_folder which is connected to my individual drive. Then I can use the normal ‘get_item’ approach. Not ideal tbh, but sufficient for now.

hongooi73 commented 5 months ago

Are people still experiencing this bug? Shared items in Business Onedrive/Sharepoint is hard for me to debug, since I don't have access to a business MS365 account right now.

hongooi73 commented 5 months ago

@elipousson does your sharepointr package have the same problem?

elipousson commented 5 months ago

@hongooi73 I actually hadn't tried the list_share_items() method previously but I am encountering what seems to be a similar error. I do have a batch download function in my own package but it uses get_item and then uses the download method on the item.

So far, I can't tell the difference (if there is any) between an element of the list created with list_shared_items() and get_item() but one works and the other doesn't.

hongooi73 commented 5 months ago

So far, I can't tell the difference (if there is any) between an element of the list created with list_shared_items() and get_item() but one works and the other doesn't.

@elipousson The info returned by Graph is all in the properties field of the R6 object. If you compare this field in the objects returned by get_item and list_shared_items, do you see any difference?

hongooi73 commented 5 months ago

The 'shared-item-fix' branch reverts the code to what it was in the earlier version. Can people affected by this give it a go, and tell me if it works?

hongooi73 commented 5 months ago

@elipousson @SHogenboom @RealcoJaneZheng is the fix working?

elipousson commented 5 months ago

@hongooi73 Yep. I installed from the branch and can confirm that the download method for the ms_drive_item object is working. I didn't do any code review comparing the branch and the existing version so, if there are any additional tests you'd like me to run, let me know.