This object is basically just a file path, except it additionally has an attribute for the file origin. This is used to then be able to infer a connection object based on the source_file object created.

source_file(path, origin = "local")

Arguments

path

File path respective to the specified origin

origin

Origin of the file - either onedrive, sharepoint, or local

Value

source_file object

Details

Since file connections are eliminated and garbage collected once they're closed, they're unreliable as persistent objects in your R session. To get around this, m365filer creates the file connections on demand. To preserve the automation of this, this object is created, which feeds into get_file_connection() to return a connection object, which is then used to interface with OneDrive or SharePoint as necessary

Examples


source_file('some/file/path.txt', 'local')
#> [1] "some/file/path.txt"
#> attr(,"class")
#> [1] "source_file" "character"  
#> attr(,"origin")
#> [1] "local"
source_file('some/file/path.txt', 'onedrive')
#> [1] "some/file/path.txt"
#> attr(,"class")
#> [1] "source_file" "character"  
#> attr(,"origin")
#> [1] "onedrive"
source_file('some/file/path.txt', 'sharepoint')
#> [1] "some/file/path.txt"
#> attr(,"class")
#> [1] "source_file" "character"  
#> attr(,"origin")
#> [1] "sharepoint"