/me and /users/{id} basics: who the token belongs to, and the user ids the drive functions take. App-only tokens have no /me; address users by id or user principal name instead.

Permissions. User.Read (delegated, /me); User.Read.All (application, any user; User.ReadBasic.All for basic fields).

Values

USER_SELECT

USER_SELECT: Str "id,displayName,userPrincipalName,mail,givenName,surname,jobTitle,preferredLanguage"

Functions

get-user

fn (id-or-upn: Str): Map
fn (id-or-upn: Str, opts: Map): Map

GET /users/{id | userPrincipalName}. opts takes OData options (select, expand) and credentials.

Example

user ::microsoft::graph::users/get-user("alex@contoso.com", {select: "id,mail"})
user.mail

list-users

fn (): Vec
fn (opts: Map): Vec
fn (opts: Map, limit: Int?): Vec

GET /users - every user (following @odata.nextLink), or at most limit. opts takes OData options; search and count add ConsistencyLevel: eventual for you.

staff ::microsoft::graph::users/list-users({filter: "accountEnabled eq true", select: ["id", "mail"]}, 500)

me

fn (): Map
fn (opts: Map): Map

GET /me - the signed-in user (delegated tokens only). opts takes OData options (select, default the common profile fields) and credentials.

who ::microsoft::graph::users/me()
who.userPrincipalName

user-path

fn (id-or-upn: Str): Str

The Graph path for a user id or user principal name: /users/{encoded} (pure).

Example

::microsoft::graph::users/user-path("alex@contoso.com")  // "/users/alex%40contoso.com"