Grant the specified user access to submit print jobs to the associated printerShare.
Permissions
One of the following permissions is required to call this API. To learn more, including how to choose permissions, see Permissions.
To use the Universal Print service, the user or app's tenant must have an active Universal Print subscription, in addition to the permissions listed in the following table. The signed in user must be a Printer Administrator.
Permission type
Permissions (from least to most privileged)
Delegated (work or school account)
PrinterShare.ReadWrite.All
Delegated (personal Microsoft account)
Not Supported.
Application
Not Supported.
HTTP request
POST /print/shares/{printerShareId}/allowedUsers/$ref
Request headers
Name
Description
Authorization
Bearer {token}. Required.
Content-Type
application/json. Required.
Request body
In the request body, supply a reference to a user entity by using the @odata.id format, as shown in the following example.
Response
If successful, this method returns a 204 No Content response code.
POST https://graph.microsoft.com/v1.0/print/shares/{printerShareId}/allowedUsers/$ref
Content-Type: application/json
{
"@odata.id": "https://graph.microsoft.com/v1.0/users/{userId}"
}
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
var user = new User
{
AdditionalData = new Dictionary<string, object>()
{
{"@odata.id", "https://graph.microsoft.com/v1.0/users/{userId}"}
}
};
await graphClient.Print.Shares["{printerShare-id}"].AllowedUsers.References
.Request()
.AddAsync(user);
GraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();
User user = new User();
user.additionalDataManager().put("@odata.id", new JsonPrimitive("https://graph.microsoft.com/v1.0/users/{userId}"));
graphClient.print().shares("{printerShareId}").allowedUsers().references()
.buildRequest()
.post(user);