Azure / Microsoft365R

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

Unable to upload file on one drive business #114

Closed da2807 closed 2 years ago

da2807 commented 2 years ago

Hi,

Have been exploring the MicrosoftR package to upload files to Microsoft one drive business but with no luck!

Am using odb$upload_file function following documentation here [(https://github.com/Azure/Microsoft365R)]. The only difference is that the one drive functions are explained for one drive personal and not business. E.g. when i run below, receive the following error: odb$upload_file("filename2022.csv")

Error in private$make_absolute_path(dest) : argument "dest" is missing, with no default

What should be the destination path here? have tried several combinations of the one drive link, however none work.

Thanks AD

hongooi73 commented 2 years ago

The Onedrive interface functions identically for the personal and business versions. As the documentation in ?ms_drive states:

download_file and upload_file transfer files between the local machine and the drive. For download_file, the default destination folder is the current (working) directory of your R session. For upload_file, there is no default destination folder; make sure you specify the destination explicitly.

The destination should be the name of the file when uploaded, along with an optional directory, like this:

odb$upload_file("filename2022.csv", "filename2022.csv")

# renaming on upload
odb$upload_file("filename2022.csv", "filename_new.csv")

# uploading to a directory
odb$upload_file("filename2022.csv", "path/to/dir/filename2022.csv")