更新位置
命名空间:microsoft.graph
重要
Microsoft Graph版本下的 /beta API 可能会发生更改。 不支持在生产应用程序中使用这些 API。 若要确定 API 是否在 v1.0 中可用,请使用 版本 选择器。
更新 place 对象的属性,该属性可以是 会议室 或 roomList。 可以通过指定 ID 或 emailAddress 属性来标识 会议室 或 roomList。
权限
要调用此 API,需要以下权限之一。要了解详细信息,包括如何选择权限的信息,请参阅权限。
| 权限类型 |
权限(从最低特权到最高特权) |
| 委派(工作或学校帐户) |
Place.ReadWrite.All |
| 委派(个人 Microsoft 帐户) |
不支持。 |
| 应用 |
不支持 |
HTTP 请求
PATCH /places/{id | emailAddress}
| 名称 |
值 |
| Authorization |
Bearer {token}。必需。 |
| Content-Type |
application/json. Required. |
请求正文
在请求正文中,提供应更新的相关字段的值。 一次只能更新一个位置资源 (会议室 或 roomList) 实例。 在请求正文中,用于 @odata.type 指定位置类型,并包含要更新的类型的属性。 请求正文中不包括的现有属性将保留其以前的值,或根据对其他属性值的更改重新计算。 为了获得最佳性能,请勿加入尚未更改的现有值。
| 属性 |
类型 |
说明 |
| address |
physicalAddress |
会议室或会议室列表的街道地址。 |
| audioDeviceName |
String |
指定会议室中音频设备的名称。 |
| bookingType |
bookingType |
房间类型。 可能的值为 Standard 和 Reserved。 |
| 建筑 |
String |
指定会议室所在的建筑物名称或建筑物号。 |
| 能力 |
Int32 |
指定房间的容量。 |
| displayDeviceName |
String |
指定会议室中显示设备的名称。 |
| floorLabel |
String |
指定会议室所在的地板字母。 |
| floorNumber |
Int32 |
指定房间所在的楼层号。 |
| geoCoordinates |
outlookGeoCoordinates |
指定纬度、经度和可选高度坐标中的房间或会议室列表位置。 |
| isWheelChairAccessible |
布尔值 |
指定房间是否可使用轮椅。 |
| 标签 |
字符串 |
指定会议室的描述性标签,例如数字或名称。 |
| 昵称 |
字符串 |
指定房间的昵称,例如“conf room”。 |
| phone |
String |
会议室或会议室列表的电话号码。 |
| 标记 |
String collection |
指定会议室的其他功能,例如,视图类型或家具类型的详细信息。 |
| videoDeviceName |
字符串 |
指定会议室中视频设备的名称。 |
响应
如果成功,此方法在响应正文中返回 200 OK 响应代码和更新 的 place 对象。
示例
示例 1:更新会议室
请求
下面展示了示例请求。
PATCH https://graph.microsoft.com/beta/places/cf100@contoso.com
Content-type: application/json
{
"@odata.type": "microsoft.graph.room",
"nickname": "Conf Room",
"building": "1",
"label": "100",
"capacity": 50,
"isWheelChairAccessible": false
}
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
var place = new Room
{
Nickname = "Conf Room",
Building = "1",
Label = "100",
Capacity = 50,
IsWheelChairAccessible = false
};
await graphClient.Places["{place-id}"]
.Request()
.UpdateAsync(place);
const options = {
authProvider,
};
const client = Client.init(options);
const place = {
'@odata.type': 'microsoft.graph.room',
nickname: 'Conf Room',
building: '1',
label: '100',
capacity: 50,
isWheelChairAccessible: false
};
await client.api('/places/cf100@contoso.com')
.version('beta')
.update(place);
MSHTTPClient *httpClient = [MSClientFactory createHTTPClientWithAuthenticationProvider:authenticationProvider];
NSString *MSGraphBaseURL = @"https://graph.microsoft.com/beta/";
NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:[MSGraphBaseURL stringByAppendingString:@"/places/cf100@contoso.com"]]];
[urlRequest setHTTPMethod:@"PATCH"];
[urlRequest setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
MSGraphPlace *place = [[MSGraphPlace alloc] init];
[place setNickname:@"Conf Room"];
[place setBuilding:@"1"];
[place setLabel:@"100"];
[place setCapacity: 50];
[place setIsWheelChairAccessible: false];
NSError *error;
NSData *placeData = [place getSerializedDataWithError:&error];
[urlRequest setHTTPBody:placeData];
MSURLSessionDataTask *meDataTask = [httpClient dataTaskWithRequest:urlRequest
completionHandler: ^(NSData *data, NSURLResponse *response, NSError *nserror) {
//Request Completed
}];
[meDataTask execute];
GraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();
Room place = new Room();
place.nickname = "Conf Room";
place.building = "1";
place.label = "100";
place.capacity = 50;
place.isWheelChairAccessible = false;
graphClient.places("cf100@contoso.com")
.buildRequest()
.patch(place);
//THE GO SDK IS IN PREVIEW. NON-PRODUCTION USE ONLY
graphClient := msgraphsdk.NewGraphServiceClient(requestAdapter)
requestBody := msgraphsdk.NewPlace()
requestBody.SetAdditionalData(map[string]interface{}{
"@odata.type": "microsoft.graph.room",
"nickname": "Conf Room",
"building": "1",
"label": "100",
"capacity": ,
"isWheelChairAccessible": false,
}
placeId := "place-id"
graphClient.PlacesById(&placeId).Patch(requestBody)
Import-Module Microsoft.Graph.Calendar
$params = @{
"@odata.type" = "microsoft.graph.room"
Nickname = "Conf Room"
Building = "1"
Label = "100"
Capacity =
IsWheelChairAccessible = $false
}
Update-MgPlace -PlaceId $placeId -BodyParameter $params
响应
下面展示了示例响应。
备注
为了提高可读性,可能缩短了此处显示的响应对象。
HTTP/1.1 200 OK
Content-type: application/json
{
"@odata.context": "https://graph.microsoft.com/beta/$metadata#places/$entity",
"@odata.type": "#microsoft.graph.room",
"id": "3162F1E1-C4C0-604B-51D8-91DA78989EB1",
"emailAddress": "cf100@contoso.com",
"displayName": "Conf Room 100",
"address": {
"street": "4567 Main Street",
"city": "Buffalo",
"state": "NY",
"postalCode": "98052",
"countryOrRegion": "USA"
},
"geoCoordinates": {
"latitude": 47.0,
"longitude": -122.0
},
"phone": "555-555-0100",
"nickname": "Conf Room",
"label": "100",
"capacity": 50,
"building": "1",
"floorLabel": "1P",
"floorNumber": 1,
"isManaged": true,
"isWheelChairAccessible": false,
"bookingType": "standard",
"tags": [
"bean bags"
],
"audioDeviceName": null,
"videoDeviceName": null,
"displayDevice": "surface hub"
}
示例 2:更新会议室列表
请求
下面展示了示例请求。
PATCH https://graph.microsoft.com/beta/places/Building1RroomList@contoso.onmicrosoft.com
Content-type: application/json
{
"@odata.type": "microsoft.graph.roomList",
"displayName": "Building 1",
"phone":"555-555-0100",
"address": {
"street": "4567 Main Street",
"city": "Buffalo",
"state": "NY",
"postalCode": "98052",
"countryOrRegion": "USA"
},
"geoCoordinates": {
"altitude": null,
"latitude": 47.0,
"longitude": -122.0,
"accuracy": null,
"altitudeAccuracy": null
}
}
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
var place = new RoomList
{
DisplayName = "Building 1",
Phone = "555-555-0100",
Address = new PhysicalAddress
{
Street = "4567 Main Street",
City = "Buffalo",
State = "NY",
PostalCode = "98052",
CountryOrRegion = "USA"
},
GeoCoordinates = new OutlookGeoCoordinates
{
Altitude = null,
Latitude = 47,
Longitude = -122,
Accuracy = null,
AltitudeAccuracy = null
}
};
await graphClient.Places["{place-id}"]
.Request()
.UpdateAsync(place);
const options = {
authProvider,
};
const client = Client.init(options);
const place = {
'@odata.type': 'microsoft.graph.roomList',
displayName: 'Building 1',
phone: '555-555-0100',
address: {
street: '4567 Main Street',
city: 'Buffalo',
state: 'NY',
postalCode: '98052',
countryOrRegion: 'USA'
},
geoCoordinates: {
altitude: null,
latitude: 47.0,
longitude: -122.0,
accuracy: null,
altitudeAccuracy: null
}
};
await client.api('/places/Building1RroomList@contoso.onmicrosoft.com')
.version('beta')
.update(place);
MSHTTPClient *httpClient = [MSClientFactory createHTTPClientWithAuthenticationProvider:authenticationProvider];
NSString *MSGraphBaseURL = @"https://graph.microsoft.com/beta/";
NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:[MSGraphBaseURL stringByAppendingString:@"/places/Building1RroomList@contoso.onmicrosoft.com"]]];
[urlRequest setHTTPMethod:@"PATCH"];
[urlRequest setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
MSGraphPlace *place = [[MSGraphPlace alloc] init];
[place setDisplayName:@"Building 1"];
[place setPhone:@"555-555-0100"];
MSGraphPhysicalAddress *address = [[MSGraphPhysicalAddress alloc] init];
[address setStreet:@"4567 Main Street"];
[address setCity:@"Buffalo"];
[address setState:@"NY"];
[address setPostalCode:@"98052"];
[address setCountryOrRegion:@"USA"];
[place setAddress:address];
MSGraphOutlookGeoCoordinates *geoCoordinates = [[MSGraphOutlookGeoCoordinates alloc] init];
[geoCoordinates setAltitude: null];
[geoCoordinates setLatitude: 47.0];
[geoCoordinates setLongitude: -122.0];
[geoCoordinates setAccuracy: null];
[geoCoordinates setAltitudeAccuracy: null];
[place setGeoCoordinates:geoCoordinates];
NSError *error;
NSData *placeData = [place getSerializedDataWithError:&error];
[urlRequest setHTTPBody:placeData];
MSURLSessionDataTask *meDataTask = [httpClient dataTaskWithRequest:urlRequest
completionHandler: ^(NSData *data, NSURLResponse *response, NSError *nserror) {
//Request Completed
}];
[meDataTask execute];
GraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();
RoomList place = new RoomList();
place.displayName = "Building 1";
place.phone = "555-555-0100";
PhysicalAddress address = new PhysicalAddress();
address.street = "4567 Main Street";
address.city = "Buffalo";
address.state = "NY";
address.postalCode = "98052";
address.countryOrRegion = "USA";
place.address = address;
OutlookGeoCoordinates geoCoordinates = new OutlookGeoCoordinates();
geoCoordinates.altitude = 0d;
geoCoordinates.latitude = 47.0d;
geoCoordinates.longitude = -122.0d;
geoCoordinates.accuracy = 0d;
geoCoordinates.altitudeAccuracy = 0d;
place.geoCoordinates = geoCoordinates;
graphClient.places("Building1RroomList@contoso.onmicrosoft.com")
.buildRequest()
.patch(place);
//THE GO SDK IS IN PREVIEW. NON-PRODUCTION USE ONLY
graphClient := msgraphsdk.NewGraphServiceClient(requestAdapter)
requestBody := msgraphsdk.NewPlace()
displayName := "Building 1"
requestBody.SetDisplayName(&displayName)
phone := "555-555-0100"
requestBody.SetPhone(&phone)
address := msgraphsdk.NewPhysicalAddress()
requestBody.SetAddress(address)
street := "4567 Main Street"
address.SetStreet(&street)
city := "Buffalo"
address.SetCity(&city)
state := "NY"
address.SetState(&state)
postalCode := "98052"
address.SetPostalCode(&postalCode)
countryOrRegion := "USA"
address.SetCountryOrRegion(&countryOrRegion)
geoCoordinates := msgraphsdk.NewOutlookGeoCoordinates()
requestBody.SetGeoCoordinates(geoCoordinates)
geoCoordinates.SetAltitude(nil)
latitude := float64(47)
geoCoordinates.SetLatitude(&latitude)
longitude := float64(-122)
geoCoordinates.SetLongitude(&longitude)
geoCoordinates.SetAccuracy(nil)
geoCoordinates.SetAltitudeAccuracy(nil)
requestBody.SetAdditionalData(map[string]interface{}{
"@odata.type": "microsoft.graph.roomList",
}
placeId := "place-id"
graphClient.PlacesById(&placeId).Patch(requestBody)
Import-Module Microsoft.Graph.Calendar
$params = @{
"@odata.type" = "microsoft.graph.roomList"
DisplayName = "Building 1"
Phone = "555-555-0100"
Address = @{
Street = "4567 Main Street"
City = "Buffalo"
State = "NY"
PostalCode = "98052"
CountryOrRegion = "USA"
}
GeoCoordinates = @{
Altitude = $null
Latitude = 47
Longitude = -122
Accuracy = $null
AltitudeAccuracy = $null
}
}
Update-MgPlace -PlaceId $placeId -BodyParameter $params
响应
下面展示了示例响应。
备注
为了提高可读性,可能缩短了此处显示的响应对象。
HTTP/1.1 200 OK
Content-type: application/json
{
"@odata.context": "https://graph.microsoft.com/beta/$metadata#places/$entity",
"@odata.type": "#microsoft.graph.roomList",
"id": "DC404124-302A-92AA-F98D-7B4DEB0C1705",
"displayName": "Building 1",
"address": {
"street": "4567 Main Street",
"city": "Buffalo",
"state": "NY",
"postalCode": "98052",
"countryOrRegion": "USA"
},
"geoCoordinates": {
"altitude": null,
"latitude": 47.0,
"longitude": -122.0,
"accuracy": null,
"altitudeAccuracy": null
},
"phone": "555-555-0100",
"emailAddress": "bldg1@contoso.com"
}