Create (register) a printer with the Universal Print service. This is a long-running operation and as such, it returns a printerCreateOperation that can be used to track and verify the registration of the printer.
For help creating the required Certificate Signing Request (CSR) for creating printer, see the CSR generation code sample.
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.
The X.509 Certificate Signing Request (CSR) for the certificate created and used by the printer to identify itself.
Yes
connectorId
String
ID of the connector acting as proxy to the printer.
No
Response
If successful, this method returns a 202 Accepted response code and a link to the associated printerCreateOperation in the Operation-Location header.
You make a GET request to the linked URL to get the status of an ongoing printer registration. After printer registration has completed successfully, a GET request to the linked URL will contain the created printer object and registered certificate.
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Print.Printers.Create;
using Microsoft.Graph.Models;
var requestBody = new CreatePostRequestBody
{
DisplayName = "Test Printer",
Manufacturer = "Test Printer Manufacturer",
Model = "Test Printer Model",
PhysicalDeviceId = null,
HasPhysicalDevice = false,
CertificateSigningRequest = new PrintCertificateSigningRequest
{
Content = "{content}",
TransportKey = "{sampleTransportKey}",
},
ConnectorId = null,
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
await graphClient.Print.Printers.Create.PostAsync(requestBody);
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
com.microsoft.graph.print.printers.create.CreatePostRequestBody createPostRequestBody = new com.microsoft.graph.print.printers.create.CreatePostRequestBody();
createPostRequestBody.setDisplayName("Test Printer");
createPostRequestBody.setManufacturer("Test Printer Manufacturer");
createPostRequestBody.setModel("Test Printer Model");
createPostRequestBody.setPhysicalDeviceId(null);
createPostRequestBody.setHasPhysicalDevice(false);
PrintCertificateSigningRequest certificateSigningRequest = new PrintCertificateSigningRequest();
certificateSigningRequest.setContent("{content}");
certificateSigningRequest.setTransportKey("{sampleTransportKey}");
createPostRequestBody.setCertificateSigningRequest(certificateSigningRequest);
createPostRequestBody.setConnectorId(null);
graphClient.print().printers().create().post(createPostRequestBody);
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
from msgraph.generated.print.printers.create.create_post_request_body import CreatePostRequestBody
from msgraph.generated.models.print_certificate_signing_request import PrintCertificateSigningRequest
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = CreatePostRequestBody(
display_name = "Test Printer",
manufacturer = "Test Printer Manufacturer",
model = "Test Printer Model",
physical_device_id = None,
has_physical_device = False,
certificate_signing_request = PrintCertificateSigningRequest(
content = "{content}",
transport_key = "{sampleTransportKey}",
),
connector_id = None,
)
await graph_client.print.printers.create.post(request_body)