POST https://graph.microsoft.com/beta/print/shares
Content-type: application/json
{
"name": "name-value",
"printer@odata.bind": "https://graph.microsoft.com/beta/print/printers/{id}"
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models;
var requestBody = new PrinterShare
{
Name = "name-value",
AdditionalData = new Dictionary<string, object>
{
{
"printer@odata.bind" , "https://graph.microsoft.com/beta/print/printers/{id}"
},
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Print.Shares.PostAsync(requestBody);
// THE CLI IS IN PREVIEW. NON-PRODUCTION USE ONLY
mgc-beta print shares create --body '{\
"name": "name-value",\
"printer@odata.bind": "https://graph.microsoft.com/beta/print/printers/{id}"\
}\
'
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
PrinterShare printerShare = new PrinterShare();
printerShare.setName("name-value");
HashMap<String, Object> additionalData = new HashMap<String, Object>();
additionalData.put("printer@odata.bind", "https://graph.microsoft.com/beta/print/printers/{id}");
printerShare.setAdditionalData(additionalData);
PrinterShare result = graphClient.print().shares().post(printerShare);