if (FALSE) {
# Create a Graph API client with default credentials
graph <- azr_graph_client()
# Fetch current user profile from v1.0 endpoint
me <- graph$v1.0$me()
# Fetch specific properties using OData $select
me <- graph$v1.0$me(select = c("displayName", "mail", "userPrincipalName"))
# Use beta endpoint for preview features
me_beta <- graph$beta$me(select = c("displayName", "mail"))
# Create with a custom credential chain
custom_chain <- credential_chain(
AzureCLICredential$new(scope = "https://graph.microsoft.com/.default")
)
graph <- azr_graph_client(chain = custom_chain)
# Use specific scopes instead of .default
graph <- azr_graph_client(scopes = "User.Read Mail.Read")
}
Run the code above in your browser using DataLab