Get printJob
Article
10/27/2023
12 contributors
Feedback
In this article
Namespace: microsoft.graph
Retrieve the properties and relationships of a print job.
This API is available in the following national cloud deployments .
Global service
US Government L4
US Government L5 (DOD)
China operated by 21Vianet
✅
✅
✅
❌
Permissions
Choose the permission or permissions marked as least privileged for this API. Use a higher privileged permission or permissions only if your app requires it . For details about delegated and application permissions, see Permission types . To learn more about these permissions, see the permissions reference .
Permission type
Least privileged permissions
Higher privileged permissions
Delegated (work or school account)
PrintJob.ReadBasic
PrintJob.Read, PrintJob.Read.All, PrintJob.ReadBasic.All, PrintJob.ReadWrite, PrintJob.ReadWrite.All, PrintJob.ReadWriteBasic, PrintJob.ReadWriteBasic.All
Delegated (personal Microsoft account)
Not supported.
Not supported.
Application
PrintJob.ReadBasic.All
PrintJob.Read.All, PrintJob.ReadWrite.All, PrintJob.ReadWriteBasic.All
For an app with delegated permissions to retrieve other users' jobs, the signed-in user must be a member of one of the following administrator roles:
Global Administrator
Printer Administrator
For an app with application permissions to retrieve users' jobs, the app needs a permission that grants Get printer access along with one of the application permissions described in the Permissions table.
HTTP request
To get a job from a printer:
GET /print/printers/{id}/jobs/{id}
To get a job from a printer share:
GET /print/shares/{id}/jobs/{id}
Optional query parameters
This method supports some of the OData query parameters to help customize the response. For general information, see OData query parameters .
Request body
Don't supply a request body for this method.
Response
If successful, this method returns a 200 OK
response code and a printJob object in the response body.
Examples
Example 1: Get print job
Request
The following example shows a request to get metadata for a print job.
GET https://graph.microsoft.com/v1.0/print/printers/{printerId}/jobs/{printJobId}
// Code snippets are only available for the latest version. Current version is 5.x
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Print.Printers["{printer-id}"].Jobs["{printJob-id}"].GetAsync();
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
//other-imports
)
graphClient := msgraphsdk.NewGraphServiceClientWithCredentials(cred, scopes)
jobs, err := graphClient.Print().Printers().ByPrinterId("printer-id").Jobs().ByPrintJobId("printJob-id").Get(context.Background(), nil)
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
PrintJob result = graphClient.print().printers().byPrinterId("{printer-id}").jobs().byPrintJobId("{printJob-id}").get();
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
const options = {
authProvider,
};
const client = Client.init(options);
let printJob = await client.api('/print/printers/{printerId}/jobs/{printJobId}')
.get();
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
<?php
use Microsoft\Graph\GraphServiceClient;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$result = $graphServiceClient->escapedPrint()->printers()->byPrinterId('printer-id')->jobs()->byPrintJobId('printJob-id')->get()->wait();
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
from msgraph import GraphServiceClient
graph_client = GraphServiceClient(credentials, scopes)
result = await graph_client.print.printers.by_printer_id('printer-id').jobs.by_print_job_id('printJob-id').get()
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
Response
The following example shows the response.
Note: The response object shown here might be shortened for readability.
HTTP/1.1 200 OK
Content-Type: application/json
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#print/printers('c05f3726-0d4b-4aa1-8fe9-2eb981bb26fb')/jobs/$entity",
"id": "5182",
"createdDateTime": "2020-02-04T00:00:00.0000000Z",
"createdBy": {
"id": "87d349ed-44d7-43e1-9a83-5f2406dee5bd",
"displayName": "John Smith",
"userPrincipalName": "john.smith@contoso.com"
},
"configuration": {},
"status": {
"state": "completed",
"description": "The print job has completed successfully and no further processing will take place.",
"details": [],
"isAcquiredByPrinter": true
},
"redirectedTo": null,
"redirectedFrom": null,
"isFetchable": false
}
Example 2: Get print job with task list
Request
The following example shows a request to get a print job and any tasks that are running or have run against it.
GET https://graph.microsoft.com/v1.0/print/printers/{printerId}/jobs/{printJobId}?$expand=tasks
// Code snippets are only available for the latest version. Current version is 5.x
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Print.Printers["{printer-id}"].Jobs["{printJob-id}"].GetAsync((requestConfiguration) =>
{
requestConfiguration.QueryParameters.Expand = new string []{ "tasks" };
});
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
// THE CLI IS IN PREVIEW. NON-PRODUCTION USE ONLY
mgc print printers jobs get --printer-id {printer-id} --print-job-id {printJob-id} --expand "tasks"
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
graphprint "github.com/microsoftgraph/msgraph-sdk-go/print"
//other-imports
)
graphClient := msgraphsdk.NewGraphServiceClientWithCredentials(cred, scopes)
requestParameters := &graphprint.PrintPrinterItemJobItemRequestBuilderGetQueryParameters{
Expand: [] string {"tasks"},
}
configuration := &graphprint.PrintPrinterItemJobItemRequestBuilderGetRequestConfiguration{
QueryParameters: requestParameters,
}
jobs, err := graphClient.Print().Printers().ByPrinterId("printer-id").Jobs().ByPrintJobId("printJob-id").Get(context.Background(), configuration)
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
PrintJob result = graphClient.print().printers().byPrinterId("{printer-id}").jobs().byPrintJobId("{printJob-id}").get(requestConfiguration -> {
requestConfiguration.queryParameters.expand = new String []{"tasks"};
});
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
const options = {
authProvider,
};
const client = Client.init(options);
let printJob = await client.api('/print/printers/{printerId}/jobs/{printJobId}')
.expand('tasks')
.get();
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Print\Printers\Item\Jobs\Item\PrintJobItemRequestBuilderGetRequestConfiguration;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestConfiguration = new PrintJobItemRequestBuilderGetRequestConfiguration();
$queryParameters = PrintJobItemRequestBuilderGetRequestConfiguration::createQueryParameters();
$queryParameters->expand = ["tasks"];
$requestConfiguration->queryParameters = $queryParameters;
$result = $graphServiceClient->escapedPrint()->printers()->byPrinterId('printer-id')->jobs()->byPrintJobId('printJob-id')->get($requestConfiguration)->wait();
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
Import-Module Microsoft.Graph.Devices.CloudPrint
Get-MgPrintPrinterJob -PrinterId $printerId -PrintJobId $printJobId -ExpandProperty "tasks"
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
from msgraph import GraphServiceClient
from msgraph.generated.print.printers.item.jobs.item.print_job_item_request_builder import PrintJobItemRequestBuilder
graph_client = GraphServiceClient(credentials, scopes)
query_params = PrintJobItemRequestBuilder.PrintJobItemRequestBuilderGetQueryParameters(
expand = ["tasks"],
)
request_configuration = PrintJobItemRequestBuilder.PrintJobItemRequestBuilderGetRequestConfiguration(
query_parameters = query_params,
)
result = await graph_client.print.printers.by_printer_id('printer-id').jobs.by_print_job_id('printJob-id').get(request_configuration = request_configuration)
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
Response
The following example shows the response.
Note: The response object shown here might be shortened for readability.
HTTP/1.1 200 OK
Content-Type: application/json
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#print/printers('c05f3726-0d4b-4aa1-8fe9-2eb981bb26fb')/jobs/$entity",
"id": "5182",
"createdDateTime": "2020-02-04T00:00:00.0000000Z",
"createdBy": {
"id": "87d349ed-44d7-43e1-9a83-5f2406dee5bd",
"displayName": "John Smith",
"userPrincipalName": "john.smith@contoso.com"
},
"configuration": {},
"status": {
"state": "completed",
"description": "The print job has completed successfully and no further processing will take place.",
"details": [],
"isAcquiredByPrinter": true
},
"redirectedTo": null,
"redirectedFrom": null,
"isFetchable": false,
"tasks": [
{
"id": "d036638b-1272-4bba-9227-732463823ed3",
"parentUrl": "https://graph.microsoft.com/v1.0/print/printers/c05f3726-0d4b-4aa1-8fe9-2eb981bb26fb/jobs/5182",
"status": {
"state": "processing",
"description": "The task is being processed."
}
}
]
}
Example 3: Get a print job and its associated document data
Request
The following example shows a request to get a print job and its associated document data.
GET https://graph.microsoft.com/v1.0/print/printers/{printerId}/jobs/{printJobId}?$expand=documents
// Code snippets are only available for the latest version. Current version is 5.x
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Print.Printers["{printer-id}"].Jobs["{printJob-id}"].GetAsync((requestConfiguration) =>
{
requestConfiguration.QueryParameters.Expand = new string []{ "documents" };
});
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
// THE CLI IS IN PREVIEW. NON-PRODUCTION USE ONLY
mgc print printers jobs get --printer-id {printer-id} --print-job-id {printJob-id} --expand "documents"
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
graphprint "github.com/microsoftgraph/msgraph-sdk-go/print"
//other-imports
)
graphClient := msgraphsdk.NewGraphServiceClientWithCredentials(cred, scopes)
requestParameters := &graphprint.PrintPrinterItemJobItemRequestBuilderGetQueryParameters{
Expand: [] string {"documents"},
}
configuration := &graphprint.PrintPrinterItemJobItemRequestBuilderGetRequestConfiguration{
QueryParameters: requestParameters,
}
jobs, err := graphClient.Print().Printers().ByPrinterId("printer-id").Jobs().ByPrintJobId("printJob-id").Get(context.Background(), configuration)
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
PrintJob result = graphClient.print().printers().byPrinterId("{printer-id}").jobs().byPrintJobId("{printJob-id}").get(requestConfiguration -> {
requestConfiguration.queryParameters.expand = new String []{"documents"};
});
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
const options = {
authProvider,
};
const client = Client.init(options);
let printJob = await client.api('/print/printers/{printerId}/jobs/{printJobId}')
.expand('documents')
.get();
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Print\Printers\Item\Jobs\Item\PrintJobItemRequestBuilderGetRequestConfiguration;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestConfiguration = new PrintJobItemRequestBuilderGetRequestConfiguration();
$queryParameters = PrintJobItemRequestBuilderGetRequestConfiguration::createQueryParameters();
$queryParameters->expand = ["documents"];
$requestConfiguration->queryParameters = $queryParameters;
$result = $graphServiceClient->escapedPrint()->printers()->byPrinterId('printer-id')->jobs()->byPrintJobId('printJob-id')->get($requestConfiguration)->wait();
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
Import-Module Microsoft.Graph.Devices.CloudPrint
Get-MgPrintPrinterJob -PrinterId $printerId -PrintJobId $printJobId -ExpandProperty "documents"
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
from msgraph import GraphServiceClient
from msgraph.generated.print.printers.item.jobs.item.print_job_item_request_builder import PrintJobItemRequestBuilder
graph_client = GraphServiceClient(credentials, scopes)
query_params = PrintJobItemRequestBuilder.PrintJobItemRequestBuilderGetQueryParameters(
expand = ["documents"],
)
request_configuration = PrintJobItemRequestBuilder.PrintJobItemRequestBuilderGetRequestConfiguration(
query_parameters = query_params,
)
result = await graph_client.print.printers.by_printer_id('printer-id').jobs.by_print_job_id('printJob-id').get(request_configuration = request_configuration)
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation .
Response
The following example shows the response.
Note: The response object shown here might be shortened for readability.
HTTP/1.1 200 OK
Content-Type: application/json
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#print/printers('c05f3726-0d4b-4aa1-8fe9-2eb981bb26fb')/jobs/$entity",
"id": "5182",
"createdDateTime": "2020-02-04T00:00:00.0000000Z",
"createdBy": {
"id": "87d349ed-44d7-43e1-9a83-5f2406dee5bd",
"displayName": "John Smith",
"userPrincipalName": "john.smith@contoso.com"
},
"configuration": {},
"status": {
"state": "completed",
"description": "The print job has completed successfully and no further processing will take place.",
"details": [],
"isAcquiredByPrinter": true
},
"redirectedTo": null,
"redirectedFrom": null,
"isFetchable": false,
"documents": [
{
"id": "ca96c367-c3ad-478a-bbce-fbd1cd856e73",
"displayName": "",
"contentType": "application/oxps",
"size": 276604
}
]
}