ms_drive_item: File or folder in a drive

Description Format Fields Methods Initialization Sharing See Also Examples

Description

Class representing an item (file or folder) in a OneDrive or SharePoint document library.

Format

An R6 object of class ms_drive_item, inheriting from ms_object.

Fields

Methods

Initialization

Creating new objects of this class should be done via the get_item_properties method of the ms_drive class. Calling the new() method for this class only constructs the R object; it does not call the Microsoft Graph API to retrieve or create the actual item.

Sharing

create_share_link(type, expiry, password, scope) returns a shareable link to the item. Its arguments are

This function returns a URL to access the item, for type="view" or "type=edit". For type="embed", it returns a list with components webUrl containing the URL, and webHtml containing a HTML fragment to embed the link in an IFRAME.

See Also

ms_graph, ms_site, ms_drive

Microsoft Graph overview, OneDrive API reference

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
## Not run: 

# personal OneDrive
gr2 <- get_graph_login("consumers")
me <- gr2$get_user()
mydrv <- me$get_drive()

myfile <- drv$get_item_properties("myfile.docx")
myfile$properties

# rename a file
myfile$update(name="newname.docx")

# open the file in the browser
myfile$open()

# download the file to the working directory
myfile$download()

# delete the file (will ask for confirmation first)
myfile$delete()



## End(Not run)

hongooi73/Microsoft365R documentation built on Jan. 12, 2021, 12:36 a.m.