命名空间:microsoft.graph.search
重要
Microsoft Graph /beta
版本下的 API 可能会发生更改。 不支持在生产应用程序中使用这些 API。 若要确定 API 是否在 v1.0 中可用,请使用 版本 选择器。
更新 qna 对象的属性。
此 API 可用于以下国家级云部署。
全局服务 |
美国政府 L4 |
美国政府 L5 (DOD) |
由世纪互联运营的中国 |
✅ |
❌ |
❌ |
❌ |
权限
为此 API 选择标记为最低特权的权限。
只有在应用需要它时,才使用更高的特权权限。 有关委派权限和应用程序权限的详细信息,请参阅权限类型。 要了解有关这些权限的详细信息,请参阅 权限参考。
权限类型 |
最低特权权限 |
更高特权权限 |
委派(工作或学校帐户) |
SearchConfiguration.Read.All |
SearchConfiguration.ReadWrite.All |
委派(个人 Microsoft 帐户) |
不支持。 |
不支持。 |
应用程序 |
SearchConfiguration.Read.All |
SearchConfiguration.ReadWrite.All |
HTTP 请求
PATCH /search/qnas/{qnaId}
名称 |
说明 |
Authorization |
持有者 {token}。 必填。 详细了解 身份验证和授权。 |
Content-Type |
application/json. 必需。 |
请求正文
在请求正文中, 仅 提供要更新的属性的值。 请求正文中未包含的现有属性会保留其以前的值,或者根据对其他属性值的更改重新计算。
下表指定可更新的属性。
注意: 对集合属性(如关键字)的任何更新将替换整个集合。
属性 |
类型 |
说明 |
availabilityEndDateTime |
DateTimeOffset |
QnA 停止显示为搜索结果的日期和时间。
null 设置为 始终可用。 时间戳类型使用 ISO 8601 格式表示日期和时间信息,并且始终采用 UTC 格式。 例如,2014 年 1 月 1 日午夜 UTC 为 2014-01-01T00:00:00Z 。 |
availabilityStartDateTime |
DateTimeOffset |
QnA 开始显示为搜索结果的日期和时间。
null 设置为 始终可用。 时间戳类型使用 ISO 8601 格式表示日期和时间信息,并且始终采用 UTC 格式。 例如,2014 年 1 月 1 日午夜 UTC 为 2014-01-01T00:00:00Z 。 |
description |
String |
搜索结果中显示的答案。 继承自 searchAnswer。 |
displayName |
String |
搜索结果中显示的问题。 继承自 searchAnswer。 |
groupIds |
String collection |
能够查看此 QnA 的安全组列表。 |
keywords |
microsoft.graph.search.answerKeyword |
触发此 QnA 的关键字显示在搜索结果中。 |
languageTags |
字符串集合 |
可在其中查看此 QnA 的地理特定语言名称的列表。 每个语言标记值都遵循 {language}-{region} 模式。 例如, en-us 是美国中使用的英语。 有关可能值的列表,请参阅 支持的语言标记。 |
平台 |
microsoft.graph.devicePlatformType 集合 |
能够查看此 QnA 的设备和作系统列表。 可能的值是:android 、androidForWork 、ios 、macOS 、windowsPhone81 、windowsPhone81AndLater 、windows10AndLater 、androidWorkProfile 、unknown 、androidASOP 、androidMobileApplicationManagement 、iOSMobileApplicationManagement 、unknownFutureValue 。 |
state |
microsoft.graph.search.answerState |
QnA 的状态。 可能的值是:published 、draft 、excluded 、unknownFutureValue 。 |
targetedVariations |
microsoft.graph.search.answerVariant 集合 |
不同国家/地区或设备的 QnA 变体。 需要根据用户设备、国家/地区或两者向用户显示不同内容时使用。 日期和组设置适用于所有变体。 |
webUrl |
String |
QnA 的 URL 链接。 当用户从搜索结果中选择此 QnA 时,他们会被定向到指定的 URL。 继承自 searchAnswer。 |
响应
如果成功,此方法返回 204 No Content
响应代码。
示例
请求
以下示例显示了一个请求。
PATCH https://graph.microsoft.com/beta/search/qnas/733b26d5-af76-4eea-ac69-1a0ce8716897
Content-Type: application/json
{
"description": "The dates that Contoso offices will be closed to observe holidays. These dates may differ from the actual date of the holiday in cases where the holiday falls on a weekend."
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models.Search;
var requestBody = new Qna
{
Description = "The dates that Contoso offices will be closed to observe holidays. These dates may differ from the actual date of the holiday in cases where the holiday falls on a weekend.",
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Search.Qnas["{qna-id}"].PatchAsync(requestBody);
mgc-beta search qnas patch --qna-id {qna-id} --body '{\
"description": "The dates that Contoso offices will be closed to observe holidays. These dates may differ from the actual date of the holiday in cases where the holiday falls on a weekend."\
}\
'
// Code snippets are only available for the latest major version. Current major version is $v0.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-beta-sdk-go"
graphmodelssearch "github.com/microsoftgraph/msgraph-beta-sdk-go/models/search"
//other-imports
)
requestBody := graphmodelssearch.NewQna()
description := "The dates that Contoso offices will be closed to observe holidays. These dates may differ from the actual date of the holiday in cases where the holiday falls on a weekend."
requestBody.SetDescription(&description)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
qnas, err := graphClient.Search().Qnas().ByQnaId("qna-id").Patch(context.Background(), requestBody, nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
com.microsoft.graph.beta.models.search.Qna qna = new com.microsoft.graph.beta.models.search.Qna();
qna.setDescription("The dates that Contoso offices will be closed to observe holidays. These dates may differ from the actual date of the holiday in cases where the holiday falls on a weekend.");
com.microsoft.graph.models.search.Qna result = graphClient.search().qnas().byQnaId("{qna-id}").patch(qna);
const options = {
authProvider,
};
const client = Client.init(options);
const qna = {
description: 'The dates that Contoso offices will be closed to observe holidays. These dates may differ from the actual date of the holiday in cases where the holiday falls on a weekend.'
};
await client.api('/search/qnas/733b26d5-af76-4eea-ac69-1a0ce8716897')
.version('beta')
.update(qna);
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Models\Search\Qna;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new Qna();
$requestBody->setDescription('The dates that Contoso offices will be closed to observe holidays. These dates may differ from the actual date of the holiday in cases where the holiday falls on a weekend.');
$result = $graphServiceClient->search()->qnas()->byQnaId('qna-id')->patch($requestBody)->wait();
Import-Module Microsoft.Graph.Beta.Search
$params = @{
description = "The dates that Contoso offices will be closed to observe holidays. These dates may differ from the actual date of the holiday in cases where the holiday falls on a weekend."
}
Update-MgBetaSearchQna -QnaId $qnaId -BodyParameter $params
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
from msgraph_beta.generated.models.search.qna import Qna
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = Qna(
description = "The dates that Contoso offices will be closed to observe holidays. These dates may differ from the actual date of the holiday in cases where the holiday falls on a weekend.",
)
result = await graph_client.search.qnas.by_qna_id('qna-id').patch(request_body)
响应
以下示例显示了相应的响应。
HTTP/1.1 204 No Content