// 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)