# `GraphApi.Users`
[🔗](https://github.com/keenmate/microsoft_graph/blob/v1.0.0-rc.1/lib/graph_api/resources/users.ex#L1)

Operations on the `/users` resource.

## Examples

    # List users
    {:ok, %{"value" => users}} = GraphApi.Users.list()

    # Get a specific user
    {:ok, user} = GraphApi.Users.get("user@contoso.com")

    # With OData query
    alias GraphApi.OData
    query = OData.new() |> OData.select(["displayName", "mail"]) |> OData.top(10)
    {:ok, response} = GraphApi.Users.list(query: query)

    # Multi-tenant
    client = GraphApi.Client.new(config: config)
    {:ok, users} = GraphApi.Users.list(client: client)

# `add_app_role_assignment`

```elixir
@spec add_app_role_assignment(String.t(), map(), keyword()) ::
  {:ok, map()} | {:error, term()}
```

Adds an app role assignment to a user.

# `add_app_role_assignment_query`

```elixir
@spec add_app_role_assignment_query(String.t(), map(), keyword()) ::
  GraphApi.Batch.Request.t()
```

Batch query variant of `add_app_role_assignment/3`.

# `assign_license`

```elixir
@spec assign_license(String.t(), map(), keyword()) :: {:ok, map()} | {:error, term()}
```

Assigns licenses to a user.

# `assign_license_query`

```elixir
@spec assign_license_query(String.t(), map(), keyword()) :: GraphApi.Batch.Request.t()
```

Batch query variant of `assign_license/3`.

# `assign_manager`

```elixir
@spec assign_manager(String.t(), String.t(), keyword()) :: :ok | {:error, term()}
```

Assigns a manager to a user.

# `assign_manager_query`

```elixir
@spec assign_manager_query(String.t(), String.t(), keyword()) ::
  GraphApi.Batch.Request.t()
```

Batch query variant of `assign_manager/3`.

# `change_password`

```elixir
@spec change_password(String.t(), map(), keyword()) :: :ok | {:error, term()}
```

Changes a user's password.

# `change_password_query`

```elixir
@spec change_password_query(String.t(), map(), keyword()) ::
  GraphApi.Batch.Request.t()
```

Batch query variant of `change_password/3`.

# `check_member_groups`

```elixir
@spec check_member_groups(String.t(), map(), keyword()) ::
  {:ok, map()} | {:error, term()}
```

Checks membership in a list of group IDs.

# `check_member_groups_query`

```elixir
@spec check_member_groups_query(String.t(), map(), keyword()) ::
  GraphApi.Batch.Request.t()
```

Batch query variant of `check_member_groups/3`.

# `check_member_objects`

```elixir
@spec check_member_objects(String.t(), map(), keyword()) ::
  {:ok, map()} | {:error, term()}
```

Checks membership in a list of group or directory role IDs.

# `check_member_objects_query`

```elixir
@spec check_member_objects_query(String.t(), map(), keyword()) ::
  GraphApi.Batch.Request.t()
```

Batch query variant of `check_member_objects/3`.

# `create`

```elixir
@spec create(
  map(),
  keyword()
) :: {:ok, map()} | {:error, term()}
```

Creates a new user.

# `create_query`

```elixir
@spec create_query(
  map(),
  keyword()
) :: GraphApi.Batch.Request.t()
```

Batch query variant of `create/2`. Returns a `%Batch.Request{}`.

# `delete`

```elixir
@spec delete(
  String.t(),
  keyword()
) :: :ok | {:error, term()}
```

Deletes a user.

# `delete_query`

```elixir
@spec delete_query(
  String.t(),
  keyword()
) :: GraphApi.Batch.Request.t()
```

Batch query variant of `delete/2`. Returns a `%Batch.Request{}`.

# `delta`

```elixir
@spec delta(keyword()) :: {:ok, GraphApi.Delta.delta_page()} | {:error, term()}
```

Delta query for users. Returns changes since the last sync.

See `GraphApi.Delta` for details.

# `delta_query`

```elixir
@spec delta_query(keyword()) :: GraphApi.Batch.Request.t()
```

Batch query variant of `delta/1`.

# `export_personal_data`

```elixir
@spec export_personal_data(String.t(), map(), keyword()) :: :ok | {:error, term()}
```

Exports a user's personal data.

# `export_personal_data_query`

```elixir
@spec export_personal_data_query(String.t(), map(), keyword()) ::
  GraphApi.Batch.Request.t()
```

Batch query variant of `export_personal_data/3`.

# `get`

```elixir
@spec get(
  String.t(),
  keyword()
) :: {:ok, map()} | {:error, term()}
```

Gets a user by ID or userPrincipalName.

# `get_manager`

```elixir
@spec get_manager(
  String.t(),
  keyword()
) :: {:ok, map()} | {:error, term()}
```

Gets a user's manager.

# `get_manager_query`

```elixir
@spec get_manager_query(
  String.t(),
  keyword()
) :: GraphApi.Batch.Request.t()
```

Batch query variant of `get_manager/2`.

# `get_member_groups`

```elixir
@spec get_member_groups(String.t(), map(), keyword()) ::
  {:ok, map()} | {:error, term()}
```

Returns all group IDs that a user is a member of (transitive).

# `get_member_groups_query`

```elixir
@spec get_member_groups_query(String.t(), map(), keyword()) ::
  GraphApi.Batch.Request.t()
```

Batch query variant of `get_member_groups/3`.

# `get_member_objects`

```elixir
@spec get_member_objects(String.t(), map(), keyword()) ::
  {:ok, map()} | {:error, term()}
```

Returns all group and directory role IDs that a user is a member of (transitive).

# `get_member_objects_query`

```elixir
@spec get_member_objects_query(String.t(), map(), keyword()) ::
  GraphApi.Batch.Request.t()
```

Batch query variant of `get_member_objects/3`.

# `get_photo`

```elixir
@spec get_photo(
  String.t(),
  keyword()
) :: {:ok, map()} | {:error, term()}
```

Gets a user's photo metadata.

# `get_photo_content`

```elixir
@spec get_photo_content(
  String.t(),
  keyword()
) :: {:ok, binary()} | {:error, term()}
```

Gets a user's photo binary content.

# `get_photo_query`

```elixir
@spec get_photo_query(
  String.t(),
  keyword()
) :: GraphApi.Batch.Request.t()
```

Batch query variant of `get_photo/2`.

# `get_query`

```elixir
@spec get_query(
  String.t(),
  keyword()
) :: GraphApi.Batch.Request.t()
```

Batch query variant of `get/2`. Returns a `%Batch.Request{}`.

# `list`

```elixir
@spec list(keyword()) :: {:ok, map()} | {:error, term()}
```

Lists users in the organization.

## Options

* `:client` - A configured Req client
* `:query` - An `%OData{}` struct for query parameters
* `:as` - Schema or view module to cast each result

# `list_app_role_assignments`

```elixir
@spec list_app_role_assignments(
  String.t(),
  keyword()
) :: {:ok, map()} | {:error, term()}
```

Lists app role assignments for a user.

# `list_app_role_assignments_query`

```elixir
@spec list_app_role_assignments_query(
  String.t(),
  keyword()
) :: GraphApi.Batch.Request.t()
```

Batch query variant of `list_app_role_assignments/2`.

# `list_authentication_methods`

```elixir
@spec list_authentication_methods(
  String.t(),
  keyword()
) :: {:ok, map()} | {:error, term()}
```

Lists authentication methods registered for a user.

# `list_authentication_methods_query`

```elixir
@spec list_authentication_methods_query(
  String.t(),
  keyword()
) :: GraphApi.Batch.Request.t()
```

Batch query variant of `list_authentication_methods/2`.

# `list_direct_reports`

```elixir
@spec list_direct_reports(
  String.t(),
  keyword()
) :: {:ok, map()} | {:error, term()}
```

Lists a user's direct reports.

# `list_direct_reports_query`

```elixir
@spec list_direct_reports_query(
  String.t(),
  keyword()
) :: GraphApi.Batch.Request.t()
```

Batch query variant of `list_direct_reports/2`. Returns a `%Batch.Request{}`.

# `list_license_details`

```elixir
@spec list_license_details(
  String.t(),
  keyword()
) :: {:ok, map()} | {:error, term()}
```

Lists license details for a user.

# `list_license_details_query`

```elixir
@spec list_license_details_query(
  String.t(),
  keyword()
) :: GraphApi.Batch.Request.t()
```

Batch query variant of `list_license_details/2`.

# `list_member_of`

```elixir
@spec list_member_of(
  String.t(),
  keyword()
) :: {:ok, map()} | {:error, term()}
```

Lists groups and directory roles the user is a member of.

# `list_member_of_query`

```elixir
@spec list_member_of_query(
  String.t(),
  keyword()
) :: GraphApi.Batch.Request.t()
```

Batch query variant of `list_member_of/2`. Returns a `%Batch.Request{}`.

# `list_oauth2_permission_grants`

```elixir
@spec list_oauth2_permission_grants(
  String.t(),
  keyword()
) :: {:ok, map()} | {:error, term()}
```

Lists delegated permission grants (oauth2PermissionGrants) for a user.

# `list_oauth2_permission_grants_query`

```elixir
@spec list_oauth2_permission_grants_query(
  String.t(),
  keyword()
) :: GraphApi.Batch.Request.t()
```

Batch query variant of `list_oauth2_permission_grants/2`.

# `list_query`

```elixir
@spec list_query(keyword()) :: GraphApi.Batch.Request.t()
```

Batch query variant of `list/1`. Returns a `%Batch.Request{}`.

# `list_scoped_role_member_of`

```elixir
@spec list_scoped_role_member_of(
  String.t(),
  keyword()
) :: {:ok, map()} | {:error, term()}
```

Lists scoped-role memberships for a user.

# `list_scoped_role_member_of_query`

```elixir
@spec list_scoped_role_member_of_query(
  String.t(),
  keyword()
) :: GraphApi.Batch.Request.t()
```

Batch query variant of `list_scoped_role_member_of/2`.

# `list_transitive_member_of`

```elixir
@spec list_transitive_member_of(
  String.t(),
  keyword()
) :: {:ok, map()} | {:error, term()}
```

Lists groups and directory roles the user is a transitive member of.

# `list_transitive_member_of_query`

```elixir
@spec list_transitive_member_of_query(
  String.t(),
  keyword()
) :: GraphApi.Batch.Request.t()
```

Batch query variant of `list_transitive_member_of/2`.

# `remove_app_role_assignment`

```elixir
@spec remove_app_role_assignment(String.t(), String.t(), keyword()) ::
  :ok | {:error, term()}
```

Removes an app role assignment from a user.

# `remove_app_role_assignment_query`

```elixir
@spec remove_app_role_assignment_query(String.t(), String.t(), keyword()) ::
  GraphApi.Batch.Request.t()
```

Batch query variant of `remove_app_role_assignment/3`.

# `remove_manager`

```elixir
@spec remove_manager(
  String.t(),
  keyword()
) :: :ok | {:error, term()}
```

Removes a user's manager assignment.

# `remove_manager_query`

```elixir
@spec remove_manager_query(
  String.t(),
  keyword()
) :: GraphApi.Batch.Request.t()
```

Batch query variant of `remove_manager/2`.

# `revoke_sign_in_sessions`

```elixir
@spec revoke_sign_in_sessions(
  String.t(),
  keyword()
) :: {:ok, map()} | {:error, term()}
```

Revokes all sign-in sessions for a user.

# `revoke_sign_in_sessions_query`

```elixir
@spec revoke_sign_in_sessions_query(
  String.t(),
  keyword()
) :: GraphApi.Batch.Request.t()
```

Batch query variant of `revoke_sign_in_sessions/2`.

# `update`

```elixir
@spec update(String.t(), map(), keyword()) :: {:ok, map()} | :ok | {:error, term()}
```

Updates a user.

# `update_photo_content`

```elixir
@spec update_photo_content(String.t(), binary(), keyword()) :: :ok | {:error, term()}
```

Updates a user's photo with binary content.

# `update_query`

```elixir
@spec update_query(String.t(), map(), keyword()) :: GraphApi.Batch.Request.t()
```

Batch query variant of `update/3`. Returns a `%Batch.Request{}`.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
