These functions create a connection to Microsoft 365 and saves the connection to the certeprojects
package environment. The planner_*()
and teams_*()
functions allow to work with these connections.
get_microsoft365_token(
scope = read_secret("azure.scope_list"),
tenant = read_secret("azure.tenant"),
app_id = read_secret("azure.app_id"),
auth_type = read_secret("azure.auth_type"),
...,
overwrite = TRUE,
error_on_fail = TRUE
)
connect_outlook(email = read_secret("department.mail"), overwrite = FALSE, ...)
connect_planner(
plan = read_secret("planner.name"),
team_name = read_secret("team.name"),
overwrite = FALSE,
...
)
connect_teams(team_name = read_secret("team.name"), overwrite = FALSE, ...)
any (combination) of "outlook", "teams", "planner", "tasks" (which is "planner" without group rights), or "sharepoint". Can also be a manual vector of Microsoft Permissions, such as "User.Read
.
the tenant to use, passed on to AzureGraph::create_graph_login()
the Azure app id to use, passed on to AzureGraph::create_graph_login()
the authentication method to use, passed on to AzureGraph::create_graph_login()
arguments passed on to get_microsoft365_token()
a logical to overwrite an existing connection, useful for switching accounts
a logical to indicate whether an error must be thrown if no connection can be made
email address of the user, or a shared mailbox
name of the team's plan if team_name
is not empty. Otherwise, a plan ID (for individual use).
name of the team, can be left blank to connect to an individual planner
To switch between different Outlook accounts, run connect_outlook()
with another email address, and set overwrite = TRUE
. This will allow all certemail
functions to use the newly set account.
# at default connects to the department mailbox:
connect_outlook()
# afterwards, this does nothing since `overwrite` is not set:
connect_outlook("user@certe.nl")
# this switches to the user account:
connect_outlook("user@certe.nl", overwrite = TRUE)
Using overwrite
is needed, because running just connect_outlook()
afterwards again (which many certemail
functions do) will otherwise change back to the default account.
To connect to MS Planner with a personal account, retrieve the plan ID (e.g., from the URL of the plan), and pass it on to connect_planner()
as plan
, and set overwrite = TRUE
over replace an existing connection. Make sure that team_name
is left blank:
connect_planner(plan = "AAA-0aa0AaAa-aaaAAAAAAAa", team_name = NULL, overwrite = TRUE)
Connecting to MS Teams can only be done on the group (= team) level. It is not possible to set up a connection without a valid team name.
When attaching this certeprojects
package using library()
, and external R process will be run in the background using the callr
package to connect to MS Outlook, MS Planner, and MS Teams. This will increase speed when connecting using connect_outlook()
, connect_planner()
, or connect_teams()
.