Create a new task trigger on the specified printer. Currently, only one task trigger can be specified per printer, but this limit might be removed in the future.
Note: The appId used to generate an access token for creating a task trigger should be the same appId that was used to create the corresponding task definition.
Permissions
One of the following permissions is required to call this API. To learn more, including how to choose permissions, see Permissions.
In addition to the following permissions, the user's tenant must have an active Universal Print subscription. The signed in user must be a Printer Administrator.
Permission type
Permissions (from least to most privileged)
Delegated (work or school account)
Printer.ReadWrite.All, Printer.FullControl.All
Delegated (personal Microsoft account)
Not Supported.
Application
Not Supported.
HTTP request
POST /print/printers/{printerId}/taskTriggers
Request headers
Name
Description
Authorization
Bearer {token}. Required.
Content-Type
application/json. Required.
Request body
In the request body, supply a JSON representation of a printTaskTrigger object. Supply a reference to a printTaskDefinition by using the @odata.bind format, as shown in the following example.
Response
If successful, this method returns a 201 Created response code and a printTaskTrigger in the response body.
POST https://graph.microsoft.com/v1.0/print/printers/{printerId}/taskTriggers
Content-Type: application/json
{
"event": "jobStarted",
"definition@odata.bind": "https://graph.microsoft.com/v1.0/print/taskDefinitions/{taskDefinitionId}"
}
// Code snippets are only available for the latest version. Current version is 5.x
var graphClient = new GraphServiceClient(requestAdapter);
var requestBody = new PrintTaskTrigger
{
Event = PrintEvent.JobStarted,
AdditionalData = new Dictionary<string, object>
{
{
"definition@odata.bind" , "https://graph.microsoft.com/v1.0/print/taskDefinitions/{taskDefinitionId}"
},
},
};
var result = await graphClient.Print.Printers["{printer-id}"].TaskTriggers.PostAsync(requestBody);
<?php
// THIS SNIPPET IS A PREVIEW FOR THE KIOTA BASED SDK. NON-PRODUCTION USE ONLY
$graphServiceClient = new GraphServiceClient($requestAdapter);
$requestBody = new PrintTaskTrigger();
$requestBody->setEvent(new PrintEvent('jobstarted'));
$additionalData = [
'definition@odata.bind' => 'https://graph.microsoft.com/v1.0/print/taskDefinitions/{taskDefinitionId}',
];
$requestBody->setAdditionalData($additionalData);
$result = $graphServiceClient->print()->printers()->byPrinterId('printer-id')->taskTriggers()->post($requestBody);