These functions allow you to pass a SharePoint or OneDrive file path directly into the destination file parameter of a function. When writing of the file is done, the file will automatically be uploaded to SharePoint.
File path in SharePoint or OneDrive
An ms_drive
object from the Microsoft365R package
Additional parameters - reserved for potential future use
cloud_file object
These functions add an extra level of abstraction to a file connection
object. Their behavior should be exactly that of a standard file connection,
such as when you specify a directory path into a writer function like
write.csv
. Some extra metadata has been added to provide the necessary file
handling to upload or download a file to or from SharePoint or OneDrive.
When the file is closed, which is typically handled by a writer function
itself, the file connection is closed and the file is uploaded directly into
the cloud using the Microsoft365R ms_drive
object provided (Note this only
happens when the mode of the file was opened to write the file. If the mode
was read only then no uploading is performed). Additionally, note that when
reading a file from OneDrive or SharePoint, the file will only be read from
the cloud if new updates have been made during the life of the R session.
This means that redundant downloading will not take place.
To make things easier throughout your session, m365filer can make use of
the options m365filer.onedrive
and m365filer.spdrive
. Proper ms_drive
objects from the Microsoft365R package can be stored, and these drives will
automatically be recognized when calling sharepoint_file()
or onedrive_file()
For information about how the file path should be specified to properly
assign the destination of your file, see ?ms365_help
.