printConnector を更新する
[アーティクル]
06/26/2024
9 人の共同作成者
フィードバック
この記事の内容
名前空間: microsoft.graph
printConnector オブジェクトのプロパティを更新します。
この API は、次の国内クラウド展開 で使用できます。
グローバル サービス
米国政府機関 L4
米国政府機関 L5 (DOD)
21Vianet が運営する中国
✅
✅
✅
❌
アクセス許可
この API の最小特権としてマークされているアクセス許可またはアクセス許可を選択します。
アプリで必要な場合にのみ 、より高い特権のアクセス許可またはアクセス許可を使用します。 委任されたアクセス許可とアプリケーションのアクセス許可の詳細については、「アクセス許可の種類 」を参照してください。 これらのアクセス許可の詳細については、「アクセス許可のリファレンス 」を参照してください。
アクセス許可の種類
最小特権アクセス許可
より高い特権のアクセス許可
委任 (職場または学校のアカウント)
PrintConnector.ReadWrite.All
注意事項なし。
委任 (個人用 Microsoft アカウント)
サポートされていません。
サポートされていません。
アプリケーション
サポートされていません。
サポートされていません。
HTTP 要求
PATCH /print/connectors/{printConnectorId}
名前
説明
Authorization
ベアラー {token}。 必須です。
認証と認可 についての詳細をご覧ください。
Content-Type
application/json. 必須です。
要求本文
要求本文で、更新する関連フィールドの値を指定します。 要求本文に含まれていない既存のプロパティは、以前の値を維持するか、他のプロパティ値の変更に基づいて再計算されます。 最適なパフォーマンスを得るために、変更されていない既存の値を含めないでください。
応答
成功した場合、このメソッドは 200 OK
応答コードと、応答本文で更新された printConnector オブジェクトを返します。
例
要求
PATCH https://graph.microsoft.com/v1.0/print/connectors/{printConnectorId}
Content-Type: application/json
{
"displayName": "ConnectorName",
"fullyQualifiedDomainName": "CONNECTOR-MACHINE",
"operatingSystem": "Microsoft Windows 10 Enterprise Insider Preview | 10.0.19555",
"appVersion": "0.19.7338.23496",
"location": {
"latitude": 1.1,
"longitude": 2.2,
"altitudeInMeters": 3
}
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models;
var requestBody = new PrintConnector
{
DisplayName = "ConnectorName",
FullyQualifiedDomainName = "CONNECTOR-MACHINE",
OperatingSystem = "Microsoft Windows 10 Enterprise Insider Preview | 10.0.19555",
AppVersion = "0.19.7338.23496",
Location = new PrinterLocation
{
Latitude = 1.1d,
Longitude = 2.2d,
AltitudeInMeters = 3,
},
};
// To initialize your graphClient, see https://video2.skills-academy.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Print.Connectors["{printConnector-id}"].PatchAsync(requestBody);
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
mgc print connectors patch --print-connector-id {printConnector-id} --body '{\
"displayName": "ConnectorName",\
"fullyQualifiedDomainName": "CONNECTOR-MACHINE",\
"operatingSystem": "Microsoft Windows 10 Enterprise Insider Preview | 10.0.19555",\
"appVersion": "0.19.7338.23496",\
"location": {\
"latitude": 1.1,\
"longitude": 2.2,\
"altitudeInMeters": 3\
}\
}\
'
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
// Code snippets are only available for the latest major version. Current major version is $v1.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-sdk-go/models"
//other-imports
)
requestBody := graphmodels.NewPrintConnector()
displayName := "ConnectorName"
requestBody.SetDisplayName(&displayName)
fullyQualifiedDomainName := "CONNECTOR-MACHINE"
requestBody.SetFullyQualifiedDomainName(&fullyQualifiedDomainName)
operatingSystem := "Microsoft Windows 10 Enterprise Insider Preview | 10.0.19555"
requestBody.SetOperatingSystem(&operatingSystem)
appVersion := "0.19.7338.23496"
requestBody.SetAppVersion(&appVersion)
location := graphmodels.NewPrinterLocation()
latitude := float64(1.1)
location.SetLatitude(&latitude)
longitude := float64(2.2)
location.SetLongitude(&longitude)
altitudeInMeters := int32(3)
location.SetAltitudeInMeters(&altitudeInMeters)
requestBody.SetLocation(location)
// To initialize your graphClient, see https://video2.skills-academy.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
connectors, err := graphClient.Print().Connectors().ByPrintConnectorId("printConnector-id").Patch(context.Background(), requestBody, nil)
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
PrintConnector printConnector = new PrintConnector();
printConnector.setDisplayName("ConnectorName");
printConnector.setFullyQualifiedDomainName("CONNECTOR-MACHINE");
printConnector.setOperatingSystem("Microsoft Windows 10 Enterprise Insider Preview | 10.0.19555");
printConnector.setAppVersion("0.19.7338.23496");
PrinterLocation location = new PrinterLocation();
location.setLatitude(1.1d);
location.setLongitude(2.2d);
location.setAltitudeInMeters(3);
printConnector.setLocation(location);
PrintConnector result = graphClient.print().connectors().byPrintConnectorId("{printConnector-id}").patch(printConnector);
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
const options = {
authProvider,
};
const client = Client.init(options);
const printConnector = {
displayName: 'ConnectorName',
fullyQualifiedDomainName: 'CONNECTOR-MACHINE',
operatingSystem: 'Microsoft Windows 10 Enterprise Insider Preview | 10.0.19555',
appVersion: '0.19.7338.23496',
location: {
latitude: 1.1,
longitude: 2.2,
altitudeInMeters: 3
}
};
await client.api('/print/connectors/{printConnectorId}')
.update(printConnector);
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Models\PrintConnector;
use Microsoft\Graph\Generated\Models\PrinterLocation;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new PrintConnector();
$requestBody->setDisplayName('ConnectorName');
$requestBody->setFullyQualifiedDomainName('CONNECTOR-MACHINE');
$requestBody->setOperatingSystem('Microsoft Windows 10 Enterprise Insider Preview | 10.0.19555');
$requestBody->setAppVersion('0.19.7338.23496');
$location = new PrinterLocation();
$location->setLatitude(1.1);
$location->setLongitude(2.2);
$location->setAltitudeInMeters(3);
$requestBody->setLocation($location);
$result = $graphServiceClient->escapedPrint()->connectors()->byPrintConnectorId('printConnector-id')->patch($requestBody)->wait();
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
from msgraph import GraphServiceClient
from msgraph.generated.models.print_connector import PrintConnector
from msgraph.generated.models.printer_location import PrinterLocation
graph_client = GraphServiceClient(credentials, scopes)
request_body = PrintConnector(
display_name = "ConnectorName",
fully_qualified_domain_name = "CONNECTOR-MACHINE",
operating_system = "Microsoft Windows 10 Enterprise Insider Preview | 10.0.19555",
app_version = "0.19.7338.23496",
location = PrinterLocation(
latitude = 1.1,
longitude = 2.2,
altitude_in_meters = 3,
),
)
result = await graph_client.print.connectors.by_print_connector_id('printConnector-id').patch(request_body)
プロジェクトに SDK を追加 し、authProvider インスタンスを作成 する方法の詳細については、SDK のドキュメント を参照してください。
応答
注: ここに示す応答オブジェクトは、読みやすさのために短縮されている場合があります。
HTTP/1.1 200 OK
Content-Type: application/json
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#print/connectors/$entity",
"id": "9953d245-3f6e-418c-a438-67f50e69a430",
"displayName": "ConnectorName",
"fullyQualifiedDomainName": "CONNECTOR-MACHINE",
"operatingSystem": "Microsoft Windows 10 Enterprise Insider Preview | 10.0.19555",
"appVersion": "0.19.7338.23496",
"registeredDateTime": "2020-02-04T00:00:00.0000000Z",
"location": {
"latitude": 1.1,
"longitude": 2.2,
"altitudeInMeters": 3,
"streetAddress": "One Microsoft Way",
"subUnit": [
"Main Plaza",
"Unit 400"
],
"city": "Redmond",
"postalCode": "98052",
"countryOrRegion": "USA",
"site": "Puget Sound",
"building": "Studio E",
"floor": "1",
"floorDescription": "First Floor",
"roomName": "1234",
"roomDescription": "First floor copy room",
"organization": [
"C+AI",
"Microsoft Graph"
],
"subdivision": [
"King County",
"Red West"
],
"stateOrProvince": "Washington"
}
}