APIs under the /beta version in Microsoft Graph are subject to change. Use of these APIs in production applications is not supported. To determine whether an API is available in v1.0, use the Version selector.
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.
In the request body, supply a JSON representation of a printJob object. The printJob object should only contain configuration. All properties of configuration are nullable. All other fields, including job and document IDs, are set automatically during resource creation.
Right now, Universal Print supports only one printDocument per printJob object.
Response
If successful, this method returns a 201 Created response code and a printJob object and associated printDocument in the response body.
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models;
var requestBody = new PrintJob
{
DisplayName = "testjob",
Configuration = new PrintJobConfiguration
{
FeedOrientation = PrinterFeedOrientation.LongEdgeFirst,
PageRanges = new List<IntegerRange>
{
new IntegerRange
{
Start = 1L,
End = 1L,
},
},
Quality = PrintQuality.Medium,
Dpi = 600,
Orientation = PrintOrientation.Landscape,
Copies = 1,
DuplexMode = PrintDuplexMode.OneSided,
ColorMode = PrintColorMode.BlackAndWhite,
InputBin = "by-pass-tray",
OutputBin = "output-tray",
MediaSize = "A4",
Margin = new PrintMargin
{
Top = 0,
Bottom = 0,
Left = 0,
Right = 0,
},
MediaType = "stationery",
Finishings = null,
PagesPerSheet = 1,
MultipageLayout = PrintMultipageLayout.ClockwiseFromBottomLeft,
Collate = false,
Scaling = PrintScaling.ShrinkToFit,
FitPdfToPage = false,
},
};
// 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.PostAsync(requestBody);
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
// Code snippets are only available for the latest major version. Current major version is $v0.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-beta-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-beta-sdk-go/models"
//other-imports
)
requestBody := graphmodels.NewPrintJob()
displayName := "testjob"
requestBody.SetDisplayName(&displayName)
configuration := graphmodels.NewPrintJobConfiguration()
feedOrientation := graphmodels.LONGEDGEFIRST_PRINTERFEEDORIENTATION
configuration.SetFeedOrientation(&feedOrientation)
integerRange := graphmodels.NewIntegerRange()
start := int64(1)
integerRange.SetStart(&start)
end := int64(1)
integerRange.SetEnd(&end)
pageRanges := []graphmodels.IntegerRangeable {
integerRange,
}
configuration.SetPageRanges(pageRanges)
quality := graphmodels.MEDIUM_PRINTQUALITY
configuration.SetQuality(&quality)
dpi := int32(600)
configuration.SetDpi(&dpi)
orientation := graphmodels.LANDSCAPE_PRINTORIENTATION
configuration.SetOrientation(&orientation)
copies := int32(1)
configuration.SetCopies(&copies)
duplexMode := graphmodels.ONESIDED_PRINTDUPLEXMODE
configuration.SetDuplexMode(&duplexMode)
colorMode := graphmodels.BLACKANDWHITE_PRINTCOLORMODE
configuration.SetColorMode(&colorMode)
inputBin := "by-pass-tray"
configuration.SetInputBin(&inputBin)
outputBin := "output-tray"
configuration.SetOutputBin(&outputBin)
mediaSize := "A4"
configuration.SetMediaSize(&mediaSize)
margin := graphmodels.NewPrintMargin()
top := int32(0)
margin.SetTop(&top)
bottom := int32(0)
margin.SetBottom(&bottom)
left := int32(0)
margin.SetLeft(&left)
right := int32(0)
margin.SetRight(&right)
configuration.SetMargin(margin)
mediaType := "stationery"
configuration.SetMediaType(&mediaType)
finishings := null
configuration.SetFinishings(&finishings)
pagesPerSheet := int32(1)
configuration.SetPagesPerSheet(&pagesPerSheet)
multipageLayout := graphmodels.CLOCKWISEFROMBOTTOMLEFT_PRINTMULTIPAGELAYOUT
configuration.SetMultipageLayout(&multipageLayout)
collate := false
configuration.SetCollate(&collate)
scaling := graphmodels.SHRINKTOFIT_PRINTSCALING
configuration.SetScaling(&scaling)
fitPdfToPage := false
configuration.SetFitPdfToPage(&fitPdfToPage)
requestBody.SetConfiguration(configuration)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
jobs, err := graphClient.Print().Printers().ByPrinterId("printer-id").Jobs().Post(context.Background(), requestBody, nil)
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
PrintJob printJob = new PrintJob();
printJob.setDisplayName("testjob");
PrintJobConfiguration configuration = new PrintJobConfiguration();
configuration.setFeedOrientation(PrinterFeedOrientation.LongEdgeFirst);
LinkedList<IntegerRange> pageRanges = new LinkedList<IntegerRange>();
IntegerRange integerRange = new IntegerRange();
integerRange.setStart(1L);
integerRange.setEnd(1L);
pageRanges.add(integerRange);
configuration.setPageRanges(pageRanges);
configuration.setQuality(PrintQuality.Medium);
configuration.setDpi(600);
configuration.setOrientation(PrintOrientation.Landscape);
configuration.setCopies(1);
configuration.setDuplexMode(PrintDuplexMode.OneSided);
configuration.setColorMode(PrintColorMode.BlackAndWhite);
configuration.setInputBin("by-pass-tray");
configuration.setOutputBin("output-tray");
configuration.setMediaSize("A4");
PrintMargin margin = new PrintMargin();
margin.setTop(0);
margin.setBottom(0);
margin.setLeft(0);
margin.setRight(0);
configuration.setMargin(margin);
configuration.setMediaType("stationery");
configuration.setFinishings(null);
configuration.setPagesPerSheet(1);
configuration.setMultipageLayout(PrintMultipageLayout.ClockwiseFromBottomLeft);
configuration.setCollate(false);
configuration.setScaling(PrintScaling.ShrinkToFit);
configuration.setFitPdfToPage(false);
printJob.setConfiguration(configuration);
PrintJob result = graphClient.print().printers().byPrinterId("{printer-id}").jobs().post(printJob);
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Models\PrintJob;
use Microsoft\Graph\Beta\Generated\Models\PrintJobConfiguration;
use Microsoft\Graph\Beta\Generated\Models\PrinterFeedOrientation;
use Microsoft\Graph\Beta\Generated\Models\IntegerRange;
use Microsoft\Graph\Beta\Generated\Models\PrintQuality;
use Microsoft\Graph\Beta\Generated\Models\PrintOrientation;
use Microsoft\Graph\Beta\Generated\Models\PrintDuplexMode;
use Microsoft\Graph\Beta\Generated\Models\PrintColorMode;
use Microsoft\Graph\Beta\Generated\Models\PrintMargin;
use Microsoft\Graph\Beta\Generated\Models\PrintMultipageLayout;
use Microsoft\Graph\Beta\Generated\Models\PrintScaling;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new PrintJob();
$requestBody->setDisplayName('testjob');
$configuration = new PrintJobConfiguration();
$configuration->setFeedOrientation(new PrinterFeedOrientation('longEdgeFirst'));
$pageRangesIntegerRange1 = new IntegerRange();
$pageRangesIntegerRange1->setStart(1);
$pageRangesIntegerRange1->setEnd(1);
$pageRangesArray []= $pageRangesIntegerRange1;
$configuration->setPageRanges($pageRangesArray);
$configuration->setQuality(new PrintQuality('medium'));
$configuration->setDpi(600);
$configuration->setOrientation(new PrintOrientation('landscape'));
$configuration->setCopies(1);
$configuration->setDuplexMode(new PrintDuplexMode('oneSided'));
$configuration->setColorMode(new PrintColorMode('blackAndWhite'));
$configuration->setInputBin('by-pass-tray');
$configuration->setOutputBin('output-tray');
$configuration->setMediaSize('A4');
$configurationMargin = new PrintMargin();
$configurationMargin->setTop(0);
$configurationMargin->setBottom(0);
$configurationMargin->setLeft(0);
$configurationMargin->setRight(0);
$configuration->setMargin($configurationMargin);
$configuration->setMediaType('stationery');
$configuration->setFinishings(null);
$configuration->setPagesPerSheet(1);
$configuration->setMultipageLayout(new PrintMultipageLayout('clockwiseFromBottomLeft'));
$configuration->setCollate(false);
$configuration->setScaling(new PrintScaling('shrinkToFit'));
$configuration->setFitPdfToPage(false);
$requestBody->setConfiguration($configuration);
$result = $graphServiceClient->escapedPrint()->printers()->byPrinterId('printer-id')->jobs()->post($requestBody)->wait();
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
from msgraph_beta.generated.models.print_job import PrintJob
from msgraph_beta.generated.models.print_job_configuration import PrintJobConfiguration
from msgraph_beta.generated.models.printer_feed_orientation import PrinterFeedOrientation
from msgraph_beta.generated.models.integer_range import IntegerRange
from msgraph_beta.generated.models.print_quality import PrintQuality
from msgraph_beta.generated.models.print_orientation import PrintOrientation
from msgraph_beta.generated.models.print_duplex_mode import PrintDuplexMode
from msgraph_beta.generated.models.print_color_mode import PrintColorMode
from msgraph_beta.generated.models.print_margin import PrintMargin
from msgraph_beta.generated.models.print_multipage_layout import PrintMultipageLayout
from msgraph_beta.generated.models.print_scaling import PrintScaling
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = PrintJob(
display_name = "testjob",
configuration = PrintJobConfiguration(
feed_orientation = PrinterFeedOrientation.LongEdgeFirst,
page_ranges = [
IntegerRange(
start = 1,
end = 1,
),
],
quality = PrintQuality.Medium,
dpi = 600,
orientation = PrintOrientation.Landscape,
copies = 1,
duplex_mode = PrintDuplexMode.OneSided,
color_mode = PrintColorMode.BlackAndWhite,
input_bin = "by-pass-tray",
output_bin = "output-tray",
media_size = "A4",
margin = PrintMargin(
top = 0,
bottom = 0,
left = 0,
right = 0,
),
media_type = "stationery",
finishings = None,
pages_per_sheet = 1,
multipage_layout = PrintMultipageLayout.ClockwiseFromBottomLeft,
collate = False,
scaling = PrintScaling.ShrinkToFit,
fit_pdf_to_page = False,
),
)
result = await graph_client.print.printers.by_printer_id('printer-id').jobs.post(request_body)
Important
Microsoft Graph SDKs use the v1.0 version of the API by default, and do not support all the types, properties, and APIs available in the beta version. For details about accessing the beta API with the SDK, see Use the Microsoft Graph SDKs with the beta API.