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.String
accessToken
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.String[]
selectProperties
Allows providing the names of properties to return regarding the users. If not provided, the standard properties will be returned. |
|
System.Int32
startIndex
First item in the results returned by Microsoft Graph to return |
|
System.Nullable<System.Int32>
endIndex
Last item in the results returned by Microsoft Graph to return. Provide NULL to return all results that exist. |
|
System.Int32
retryCount
Number of times to retry the request in case of throttling |
|
System.Int32
delay
Milliseconds to wait before retrying the request. The delay will be increased (doubled) every retry. |
|
System.Boolean
useBetaEndPoint
Indicates if the v1.0 (false) or beta (true) endpoint should be used at Microsoft Graph to query for the data |
|
System.Boolean
ignoreDefaultProperties
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. |
|
AzureEnvironment
azureEnvironment
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.String
accessToken
The OAuth 2.0 Access Token to use for invoking the Microsoft Graph |
|
System.String
userPrincipalName
The User Principal Name of the user in Azure Active Directory to return |
|
System.String[]
selectProperties
Allows providing the names of properties to return regarding the users. If not provided, the standard properties will be returned. |
|
System.Int32
startIndex
First item in the results returned by Microsoft Graph to return |
|
System.Nullable<System.Int32>
endIndex
Last item in the results returned by Microsoft Graph to return. Provide NULL to return all results that exist. |
|
System.Int32
retryCount
Number of times to retry the request in case of throttling |
|
System.Int32
delay
Milliseconds to wait before retrying the request. The delay will be increased (doubled) every retry. |
|
System.Boolean
useBetaEndPoint
Indicates if the v1.0 (false) or beta (true) endpoint should be used at Microsoft Graph to query for the data |
|
System.Boolean
ignoreDefaultProperties
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. |
|
AzureEnvironment
azureEnvironment
|
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.String
accessToken
The OAuth 2.0 Access Token to use for invoking the Microsoft Graph |
|
System.String[]
selectProperties
Allows providing the names of properties to return regarding the users. If not provided, the standard properties will be returned. |
|
System.Int32
retryCount
Number of times to retry the request in case of throttling |
|
System.Int32
delay
Milliseconds to wait before retrying the request. The delay will be increased (doubled) every retry. |
|
System.Boolean
ignoreDefaultProperties
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. |
|
AzureEnvironment
azureEnvironment
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.String
accessToken
The OAuth 2.0 Access Token to use for invoking the Microsoft Graph |
|
System.String
deltaToken
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.String
filter
OData filter to apply to retrieval of the users from the Microsoft Graph |
|
System.String
orderby
OData orderby instruction |
|
System.String[]
selectProperties
Allows providing the names of properties to return regarding the users. If not provided, the standard properties will be returned. |
|
System.Int32
startIndex
First item in the results returned by Microsoft Graph to return |
|
System.Nullable<System.Int32>
endIndex
Last item in the results returned by Microsoft Graph to return. Provide NULL to return all results that exist. |
|
System.Int32
retryCount
Number of times to retry the request in case of throttling |
|
System.Int32
delay
Milliseconds to wait before retrying the request. The delay will be increased (doubled) every retry. |
|
System.Boolean
useBetaEndPoint
Indicates if the v1.0 (false) or beta (true) endpoint should be used at Microsoft Graph to query for the data |
|
System.Boolean
ignoreDefaultProperties
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. |
|
AzureEnvironment
azureEnvironment
The type of environment to connect to |
Returns
|
UserDelta
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.String
accessToken
The OAuth 2.0 Access Token to use for invoking the Microsoft Graph |
|
System.String
filter
OData filter to apply to retrieval of the users from the Microsoft Graph |
|
System.String
orderby
OData orderby instruction |
|
System.String[]
selectProperties
Allows providing the names of properties to return regarding the users. If not provided, the standard properties will be returned. |
|
System.Int32
startIndex
First item in the results returned by Microsoft Graph to return |
|
System.Nullable<System.Int32>
endIndex
Last item in the results returned by Microsoft Graph to return. Provide NULL to return all results that exist. |
|
System.Int32
retryCount
Number of times to retry the request in case of throttling |
|
System.Int32
delay
Milliseconds to wait before retrying the request. The delay will be increased (doubled) every retry. |
|
System.Boolean
useBetaEndPoint
Indicates if the v1.0 (false) or beta (true) endpoint should be used at Microsoft Graph to query for the data |
|
System.Boolean
ignoreDefaultProperties
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. |
|
AzureEnvironment
azureEnvironment
|
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.String
accessToken
The OAuth 2.0 Access Token to use for invoking the Microsoft Graph |
|
System.String[]
additionalProperties
Allows providing the names of additional properties to return regarding the users |
|
System.Int32
startIndex
First item in the results returned by Microsoft Graph to return |
|
System.Nullable<System.Int32>
endIndex
Last item in the results returned by Microsoft Graph to return. Provide NULL to return all results that exist. |
|
System.Int32
retryCount
Number of times to retry the request in case of throttling |
|
System.Int32
delay
Milliseconds to wait before retrying the request. The delay will be increased (doubled) every retry. |
|
System.Boolean
useBetaEndPoint
Indicates if the v1.0 (false) or beta (true) endpoint should be used at Microsoft Graph to query for the data |
|
System.Boolean
ignoreDefaultProperties
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. |
|
AzureEnvironment
azureEnvironment
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.String
accessToken
The OAuth 2.0 Access Token to use for invoking the Microsoft Graph |
|
System.String
userId
Id or user principal name of the user to request the access pass for |
|
System.Nullable<DateTime>
startDateTime
Date and time at which this access pass should become valid. Optional. If not provided, it immediately become valid. |
|
System.Nullable<System.Int32>
lifeTimeInMinutes
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.Nullable<System.Boolean>
isUsableOnce
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.Int32
retryCount
Number of times to retry the request in case of throttling. Optional. |
|
System.Int32
delay
Milliseconds to wait before retrying the request. The delay will be increased (doubled) every retry. Optional. |
|
AzureEnvironment
azureEnvironment
The type of environment to connect to |
Returns
|
TemporaryAccessPassResponse
A temporary access pass for the provided user or NULL if unable to create a temporary access pass |