printConnector の更新
-
[アーティクル]
-
-
名前空間: microsoft.graph
printConnector オブジェクトのプロパティを更新 します。
アクセス許可
この API を呼び出すには、次のいずれかのアクセス許可が必要です。アクセス許可の選択方法などの詳細については、「アクセス許可」を参照してください。
ユニバーサル 印刷サービスを使用するには、ユーザーまたはアプリのテナントに、次の表に示すアクセス許可に加えて、アクティブなユニバーサル印刷サブスクリプションが必要です。 サインインしているユーザーはプリンター管理者 である必要があります。
| アクセス許可の種類 |
アクセス許可 (特権の小さいものから大きいものへ) |
| 委任 (職場または学校のアカウント) |
PrintConnector.ReadWrite.All |
| 委任 (個人用 Microsoft アカウント) |
サポートされていません。 |
| アプリケーション |
サポートされていません。 |
HTTP 要求
PATCH /print/connectors/{printConnectorId}
| 名前 |
説明 |
| Authorization |
ベアラー {token}。必須。 |
| Content-Type |
application/json. Required. |
要求本文
要求本文で、更新する関連フィールドの値を指定します。 要求本文に含まれない既存のプロパティは、以前の値のままになるか、他のプロパティ値の変化に基づいて再計算されます。 最適なパフォーマンスを得るために、変更されていない既存の値を含めないでください。
応答
成功した場合、このメソッドは応答コードと、応答本文で 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
}
}
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
var printConnector = 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.1,
Longitude = 2.2,
AltitudeInMeters = 3
}
};
await graphClient.Print.Connectors["{printConnector-id}"]
.Request()
.UpdateAsync(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 のドキュメントを参照してください。
MSHTTPClient *httpClient = [MSClientFactory createHTTPClientWithAuthenticationProvider:authenticationProvider];
NSString *MSGraphBaseURL = @"https://graph.microsoft.com/v1.0/";
NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:[MSGraphBaseURL stringByAppendingString:@"/print/connectors/{printConnectorId}"]]];
[urlRequest setHTTPMethod:@"PATCH"];
[urlRequest setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
MSGraphPrintConnector *printConnector = [[MSGraphPrintConnector alloc] init];
[printConnector setDisplayName:@"ConnectorName"];
[printConnector setFullyQualifiedDomainName:@"CONNECTOR-MACHINE"];
[printConnector setOperatingSystem:@"Microsoft Windows 10 Enterprise Insider Preview | 10.0.19555"];
[printConnector setAppVersion:@"0.19.7338.23496"];
MSGraphPrinterLocation *location = [[MSGraphPrinterLocation alloc] init];
[location setLatitude: 1.1];
[location setLongitude: 2.2];
[location setAltitudeInMeters: 3];
[printConnector setLocation:location];
NSError *error;
NSData *printConnectorData = [printConnector getSerializedDataWithError:&error];
[urlRequest setHTTPBody:printConnectorData];
MSURLSessionDataTask *meDataTask = [httpClient dataTaskWithRequest:urlRequest
completionHandler: ^(NSData *data, NSURLResponse *response, NSError *nserror) {
//Request Completed
}];
[meDataTask execute];
SDK をプロジェクトに追加し、authProvider インスタンスを作成する方法の詳細については、SDK のドキュメントを参照してください。
GraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();
PrintConnector printConnector = new PrintConnector();
printConnector.displayName = "ConnectorName";
printConnector.fullyQualifiedDomainName = "CONNECTOR-MACHINE";
printConnector.operatingSystem = "Microsoft Windows 10 Enterprise Insider Preview | 10.0.19555";
printConnector.appVersion = "0.19.7338.23496";
PrinterLocation location = new PrinterLocation();
location.latitude = 1.1d;
location.longitude = 2.2d;
location.altitudeInMeters = 3;
printConnector.location = location;
graphClient.print().connectors("{printConnectorId}")
.buildRequest()
.patch(printConnector);
SDK をプロジェクトに追加し、authProvider インスタンスを作成する方法の詳細については、SDK のドキュメントを参照してください。
//THE GO SDK IS IN PREVIEW. NON-PRODUCTION USE ONLY
graphClient := msgraphsdk.NewGraphServiceClient(requestAdapter)
requestBody := msgraphsdk.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 := msgraphsdk.NewPrinterLocation()
requestBody.SetLocation(location)
latitude := float64(1.1)
location.SetLatitude(&latitude)
longitude := float64(2.2)
location.SetLongitude(&longitude)
altitudeInMeters := int32(3)
location.SetAltitudeInMeters(&altitudeInMeters)
printConnectorId := "printConnector-id"
graphClient.Print().ConnectorsById(&printConnectorId).Patch(requestBody)
SDK をプロジェクトに追加し、authProvider インスタンスを作成する方法の詳細については、SDK のドキュメントを参照してください。
Import-Module Microsoft.Graph.Devices.CloudPrint
$params = @{
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
}
}
Update-MgPrintConnector -PrintConnectorId $printConnectorId -BodyParameter $params
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"
}
}