add_methods: Microsoft 365 object accessor methods

Description Usage Arguments Details List methods Value See Also Examples

Description

Methods for the AzureGraph::ms_graph, AzureGraph::az_user and AzureGraph::az_group classes.

Usage

 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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
## R6 method for class 'az_user'
get_chat(chat_id)

## R6 method for class 'ms_graph'
get_drive(drive_id)

## R6 method for class 'az_user'
get_drive(drive_id = NULL)

## R6 method for class 'az_group'
get_drive(drive_name = NULL, drive_id = NULL)

## R6 method for class 'az_group'
get_plan(plan_title = NULL, plan_id = NULL)

## R6 method for class 'ms_graph'
get_sharepoint_site(site_url = NULL, site_id = NULL)

## R6 method for class 'az_group'
get_sharepoint_site()

## R6 method for class 'ms_graph'
get_team(team_id = NULL)

## R6 method for class 'az_group'
get_team()

## R6 method for class 'az_user'
list_chats(filter = NULL, n = Inf)

## R6 method for class 'az_user'
list_drives(filter = NULL, n = Inf)

## R6 method for class 'az_group'
list_drives(filter = NULL, n = Inf)

## R6 method for class 'az_group'
list_plans(filter = NULL, n = Inf)

## R6 method for class 'az_user'
list_sharepoint_sites(filter = NULL, n = Inf)

## R6 method for class 'az_user'
list_teams(filter = NULL, n = Inf)

Arguments

Details

get_sharepoint_site retrieves a SharePoint site object. The method for the top-level Graph client class requires that you provide either the site URL or ID. The method for the az_group class will retrieve the site associated with that group, if applicable.

get_drive retrieves a OneDrive or shared document library, and list_drives retrieves all such drives/libraries that the user or group has access to. Whether these are personal or business drives depends on the tenant that was specified in AzureGraph::get_graph_login()/create_graph_login(): if this was "consumers" or "9188040d-6c67-4c5b-b112-36a304b66dad" (the equivalent GUID), it will be the personal OneDrive. See the examples below.

get_plan retrieves a plan (not to be confused with a Todo task list), and list_plans retrieves all plans for a group.

get_team retrieves a team. The method for the Graph client class requires the team ID. The method for the az_user class requires either the team name or ID. The method for the az_group class retrieves the team associated with the group, if it exists.

get_chat retrieves a one-on-one, group or meeting chat, by ID. list_chats retrieves all chats that the user is part of.

Note that Teams, SharePoint and OneDrive for Business require a Microsoft 365 Business license, and are available for organisational tenants only. Similarly, only Microsoft 365 groups can have associated sites/teams/plans/drives, not any other kind of group.

List methods

All list_* methods have filter and n arguments to limit the number of results. The former should be an OData expression as a string to filter the result set on. The latter should be a number setting the maximum number of (filtered) results to return. The default values are filter=NULL and n=Inf. If n=NULL, the ms_graph_pager iterator object is returned instead to allow manual iteration over the results.

Support in the underlying Graph API for OData queries is patchy. Not all endpoints that return lists of objects support filtering, and if they do, they may not allow all of the defined operators. If your filtering expression results in an error, you can carry out the operation without filtering and then filter the results on the client side.

Value

For get_sharepoint_site, an object of class ms_site.

For get_drive, an object of class ms_drive. For list_drives, a list of ms_drive objects.

For get_plan, an object of class ms_plan. For list_plans, a list of ms_plan objects.

For get_team, an object of class ms_team. For list_teams, a list of ms_team objects.

For get_chat, an object of class ms_chat. For list_chats, a list of ms_chat objects.

See Also

ms_site, ms_drive, ms_plan, ms_team, ms_chat, az_user, az_group

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
## Not run: 

# 'consumers' tenant -> personal OneDrive for a user
gr <- AzureGraph::get_graph_login("consumers", app="myapp")
me <- gr$get_user()
me$get_drive()

# organisational tenant -> business OneDrive for a user
gr2 <- AzureGraph::get_graph_login("mycompany", app="myapp")
myuser <- gr2$get_user("username@mycompany.onmicrosoft.com")
myuser$get_drive()

# get a site/drive directly from a URL/ID
gr2$get_sharepoint_site("My site")
gr2$get_drive("drive-id")

# site/drive(s) for a group
grp <- gr2$get_group("group-id")
grp$get_sharepoint_site()
grp$list_drives()
grp$get_drive()


## End(Not run)

Microsoft365R documentation built on Oct. 26, 2021, 5:07 p.m.