Class UsersUtility
Provides access to user operations in Microsoft Graph
Inheritance
Namespace: PnP.Framework.Graph
Assembly: PnP.Framework.dll
Syntax
public static class UsersUtility : object
Methods
GetUser(String, Guid, String[], Int32, Nullable<Int32>, Int32, Int32, Boolean, Boolean, AzureEnvironment)
Returns the user with the provided userId from Azure Active Directory
Declaration
public static User GetUser(string accessToken, Guid userId, string[] selectProperties = null, int startIndex = 0, int? endIndex, int retryCount = 10, int delay = 500, bool useBetaEndPoint = false, bool ignoreDefaultProperties = false, AzureEnvironment azureEnvironment = default(AzureEnvironment))
Parameters
System. The OAuth 2.0 Access Token to use for invoking the Microsoft Graph |
Guid
userId
The unique identifier of the user in Azure Active Directory to return |
System. Allows providing the names of properties to return regarding the users. If not provided, the standard properties will be returned. |
System. First item in the results returned by Microsoft Graph to return |
System. Last item in the results returned by Microsoft Graph to return. Provide NULL to return all results that exist. |
System. Number of times to retry the request in case of throttling |
System. Milliseconds to wait before retrying the request. The delay will be increased (doubled) every retry. |
System. Indicates if the v1.0 (false) or beta (true) endpoint should be used at Microsoft Graph to query for the data |
System. If set to true, only the properties provided through selectProperties will be loaded. The default properties will not be. Optional. Default is that the default properties will always be retrieved. |
Azure The type of environment to connect to |
Returns
User
List with User objects |
GetUser(String, String, String[], Int32, Nullable<Int32>, Int32, Int32, Boolean, Boolean, AzureEnvironment)
Returns the user with the provided userPrincipalName
from Azure Active Directory
Declaration
public static User GetUser(string accessToken, string userPrincipalName, string[] selectProperties = null, int startIndex = 0, int? endIndex, int retryCount = 10, int delay = 500, bool useBetaEndPoint = false, bool ignoreDefaultProperties = false, AzureEnvironment azureEnvironment = default(AzureEnvironment))
Parameters
System. The OAuth 2.0 Access Token to use for invoking the Microsoft Graph |
System. The User Principal Name of the user in Azure Active Directory to return |
System. Allows providing the names of properties to return regarding the users. If not provided, the standard properties will be returned. |
System. First item in the results returned by Microsoft Graph to return |
System. Last item in the results returned by Microsoft Graph to return. Provide NULL to return all results that exist. |
System. Number of times to retry the request in case of throttling |
System. Milliseconds to wait before retrying the request. The delay will be increased (doubled) every retry. |
System. Indicates if the v1.0 (false) or beta (true) endpoint should be used at Microsoft Graph to query for the data |
System. If set to true, only the properties provided through selectProperties will be loaded. The default properties will not be. Optional. Default is that the default properties will always be retrieved. |
Azure
|
Returns
User
User object |
ListDeletedUsers(String, String[], Int32, Int32, Boolean, AzureEnvironment)
Returns deleted Users in the current domain
Declaration
public static List<User> ListDeletedUsers(string accessToken, string[] selectProperties = null, int retryCount = 10, int delay = 500, bool ignoreDefaultProperties = false, AzureEnvironment azureEnvironment = default(AzureEnvironment))
Parameters
System. The OAuth 2.0 Access Token to use for invoking the Microsoft Graph |
System. Allows providing the names of properties to return regarding the users. If not provided, the standard properties will be returned. |
System. Number of times to retry the request in case of throttling |
System. Milliseconds to wait before retrying the request. The delay will be increased (doubled) every retry. |
System. If set to true, only the properties provided through selectProperties will be loaded. The default properties will not be. Optional. Default is that the default properties will always be retrieved. |
Azure The type of environment to connect to |
Returns
List<User>
List with User objects |
ListUserDelta(String, String, String, String, String[], Int32, Nullable<Int32>, Int32, Int32, Boolean, Boolean, AzureEnvironment)
Returns the users delta in the current domain filtered out with a custom OData filter. If no deltaToken
has been provided, all users will be returned with a deltatoken for a next run. If a deltaToken
has been provided, all users which were modified after the deltatoken has been generated will be returned.
Declaration
public static UserDelta ListUserDelta(string accessToken, string deltaToken, string filter, string orderby, string[] selectProperties = null, int startIndex = 0, int? endIndex, int retryCount = 10, int delay = 500, bool useBetaEndPoint = false, bool ignoreDefaultProperties = false, AzureEnvironment azureEnvironment = default(AzureEnvironment))
Parameters
System. The OAuth 2.0 Access Token to use for invoking the Microsoft Graph |
System. DeltaToken to indicate requesting changes since this deltatoken has been created. Leave NULL to retrieve all users with a deltatoken to use for subsequent queries. |
System. OData filter to apply to retrieval of the users from the Microsoft Graph |
System. OData orderby instruction |
System. Allows providing the names of properties to return regarding the users. If not provided, the standard properties will be returned. |
System. First item in the results returned by Microsoft Graph to return |
System. Last item in the results returned by Microsoft Graph to return. Provide NULL to return all results that exist. |
System. Number of times to retry the request in case of throttling |
System. Milliseconds to wait before retrying the request. The delay will be increased (doubled) every retry. |
System. Indicates if the v1.0 (false) or beta (true) endpoint should be used at Microsoft Graph to query for the data |
System. If set to true, only the properties provided through selectProperties will be loaded. The default properties will not be. Optional. Default is that the default properties will always be retrieved. |
Azure The type of environment to connect to |
Returns
User List with User objects |
ListUsers(String, String, String, String[], Int32, Nullable<Int32>, Int32, Int32, Boolean, Boolean, AzureEnvironment)
Returns all the Users in the current domain filtered out with a custom OData filter
Declaration
public static List<User> ListUsers(string accessToken, string filter, string orderby, string[] selectProperties = null, int startIndex = 0, int? endIndex, int retryCount = 10, int delay = 500, bool useBetaEndPoint = false, bool ignoreDefaultProperties = false, AzureEnvironment azureEnvironment = default(AzureEnvironment))
Parameters
System. The OAuth 2.0 Access Token to use for invoking the Microsoft Graph |
System. OData filter to apply to retrieval of the users from the Microsoft Graph |
System. OData orderby instruction |
System. Allows providing the names of properties to return regarding the users. If not provided, the standard properties will be returned. |
System. First item in the results returned by Microsoft Graph to return |
System. Last item in the results returned by Microsoft Graph to return. Provide NULL to return all results that exist. |
System. Number of times to retry the request in case of throttling |
System. Milliseconds to wait before retrying the request. The delay will be increased (doubled) every retry. |
System. Indicates if the v1.0 (false) or beta (true) endpoint should be used at Microsoft Graph to query for the data |
System. If set to true, only the properties provided through selectProperties will be loaded. The default properties will not be. Optional. Default is that the default properties will always be retrieved. |
Azure
|
Returns
List<User>
List with User objects |
ListUsers(String, String[], Int32, Nullable<Int32>, Int32, Int32, Boolean, Boolean, AzureEnvironment)
Returns all the Users in the current domain
Declaration
public static List<User> ListUsers(string accessToken, string[] additionalProperties = null, int startIndex = 0, int? endIndex, int retryCount = 10, int delay = 500, bool useBetaEndPoint = false, bool ignoreDefaultProperties = false, AzureEnvironment azureEnvironment = default(AzureEnvironment))
Parameters
System. The OAuth 2.0 Access Token to use for invoking the Microsoft Graph |
System. Allows providing the names of additional properties to return regarding the users |
System. First item in the results returned by Microsoft Graph to return |
System. Last item in the results returned by Microsoft Graph to return. Provide NULL to return all results that exist. |
System. Number of times to retry the request in case of throttling |
System. Milliseconds to wait before retrying the request. The delay will be increased (doubled) every retry. |
System. Indicates if the v1.0 (false) or beta (true) endpoint should be used at Microsoft Graph to query for the data |
System. If set to true, only the properties provided through selectProperties will be loaded. The default properties will not be. Optional. Default is that the default properties will always be retrieved. |
Azure The type of environment to connect to |
Returns
List<User>
List with User objects |
RequestTemporaryAccessPass(String, String, Nullable<DateTime>, Nullable<Int32>, Nullable<Boolean>, Int32, Int32, AzureEnvironment)
Retrieves a temporary access pass for the provided user
Declaration
public static TemporaryAccessPassResponse RequestTemporaryAccessPass(string accessToken, string userId, DateTime? startDateTime = null, int? lifeTimeInMinutes = null, bool? isUsableOnce = null, int retryCount = 10, int delay = 500, AzureEnvironment azureEnvironment = default(AzureEnvironment))
Parameters
System. The OAuth 2.0 Access Token to use for invoking the Microsoft Graph |
System. Id or user principal name of the user to request the access pass for |
System. Date and time at which this access pass should become valid. Optional. If not provided, it immediately become valid. |
System. Durationin minutes during which this access pass will be valid. Optional. If not provided, the default configured in Azure Active Directory will be used. |
System. Boolean indicating if the access pass can be used to only log in once or repetitively during the lifetime of the access pass. Optional. If not provided, the default configured in Azure Active Directory will be used. |
System. Number of times to retry the request in case of throttling. Optional. |
System. Milliseconds to wait before retrying the request. The delay will be increased (doubled) every retry. Optional. |
Azure The type of environment to connect to |
Returns
Temporary A temporary access pass for the provided user or NULL if unable to create a temporary access pass |