presence: clearUserPreferredPresence
命名空间:microsoft.graph
重要
Microsoft Graph版本下的 /beta API 可能会发生更改。 不支持在生产应用程序中使用这些 API。 若要确定 API 是否在 v1.0 中可用,请使用 版本 选择器。
清除用户的首选可用性和活动状态。
权限
调用 API 需要以下权限。 若要了解详细信息,包括如何选择权限的信息,请参阅权限。
| 权限类型 |
权限(从最低特权到最高特权) |
| 委派(工作或学校帐户) |
Presence.ReadWrite |
| 委派(个人 Microsoft 帐户) |
不支持。 |
| 应用程序 |
Presence.ReadWrite.All |
HTTP 请求
POST /users/{userId}/presence/clearUserPreferredPresence
| 名称 |
说明 |
| Authorization |
Bearer {token}。必需。 |
| Content-Type |
application/json. Required. |
请求正文
此请求仅包含一个空对象。
响应
如果成功,此方法返回 200 OK 响应代码。
示例
以下请求清除用户的首选状态 fa8bf3dc-eca7-46b7-bad1-db199b62afc3 。
请求
POST https://graph.microsoft.com/beta/users/fa8bf3dc-eca7-46b7-bad1-db199b62afc3/presence/clearUserPreferredPresence
Content-Type: application/json
{
}
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
await graphClient.Users["{user-id}"].Presence
.ClearUserPreferredPresence()
.Request()
.PostAsync();
const options = {
authProvider,
};
const client = Client.init(options);
const clearUserPreferredPresence = {
};
await client.api('/users/fa8bf3dc-eca7-46b7-bad1-db199b62afc3/presence/clearUserPreferredPresence')
.version('beta')
.post(clearUserPreferredPresence);
MSHTTPClient *httpClient = [MSClientFactory createHTTPClientWithAuthenticationProvider:authenticationProvider];
NSString *MSGraphBaseURL = @"https://graph.microsoft.com/beta/";
NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:[MSGraphBaseURL stringByAppendingString:@"/users/fa8bf3dc-eca7-46b7-bad1-db199b62afc3/presence/clearUserPreferredPresence"]]];
[urlRequest setHTTPMethod:@"POST"];
[urlRequest setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
NSMutableDictionary *payloadDictionary = [[NSMutableDictionary alloc] init];
NSData *data = [NSJSONSerialization dataWithJSONObject:payloadDictionary options:kNilOptions error:&error];
[urlRequest setHTTPBody:data];
MSURLSessionDataTask *meDataTask = [httpClient dataTaskWithRequest:urlRequest
completionHandler: ^(NSData *data, NSURLResponse *response, NSError *nserror) {
//Request Completed
}];
[meDataTask execute];
GraphServiceClient graphClient = GraphServiceClient.builder().authenticationProvider( authProvider ).buildClient();
graphClient.users("fa8bf3dc-eca7-46b7-bad1-db199b62afc3").presence()
.clearUserPreferredPresence()
.buildRequest()
.post();
响应
HTTP/1.1 200 OK