Redigera

Dela via


Get printJob

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.

Note: For an app with delegated permissions to cancel other users' jobs, the signed-in user must be a member of the Printer Administrator role.

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.

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

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 headers

Name Description
Authorization Bearer {token}. Required. Learn more about authentication and authorization.

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}

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

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

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
    }
  ]
}