Configurar respostas de pesquisa administrativa para usuários em uma organização
Artigo
O Microsoft Pesquisa permite que os administradores associem os termos de pesquisa a significados ou páginas da Web específicos para suas organizações e incluam essas associações como respostas de pesquisa. Por exemplo, os usuários de uma organização podem encontrar um acrônimo desconhecido que representa um nome de projeto interno ou um nome de equipe associado a uma página da Web da equipe. Os administradores podem configurar acrônimos, indicadores ou QnAs no Centro de administração do Microsoft 365, em Pesquisa & inteligência. Isso permite que os usuários usem a pesquisa para navegar e se familiarizar com seu trabalho.
Os administradores também podem usar a API do Microsoft Pesquisa no Microsoft Graph para gerenciar programaticamente respostas de pesquisa administrativa na organização. Essas respostas são exibidas na Microsoft Pesquisa resultados quando disparadas por um acrônimo ou palavra-chave definidas nos tipos de recurso de resposta de pesquisa disponíveis: recursos de sigla, indicador e qna.
Quando disparadas por um acrônimo ou palavra-chave definido, essas respostas de pesquisa aparecem na parte superior da página de resultados da pesquisa em sua organização.
Exemplo 1: Criar um novo acrônimo
A solicitação a seguir cria um novo acrônimo que é exibido na página de resultados da pesquisa quando um usuário o pesquisa.
POST https://graph.microsoft.com/v1.0/search/acronyms
Content-Type: application/json
{
"displayName": "GDPR",
"standsFor": "General Data Protection Regulation",
"description": "A European Union (EU) regulation on data protection and privacy in the EU and the European Economic Area (EEA) that enhances individuals' control and rights over their personal data, simplifies the regulatory environment for international business, and addresses the transfer of personal data outside the EU and EEA areas.",
"webUrl": "http://contoso.com/GDPR",
"state": "published"
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models.Search;
var requestBody = new Acronym
{
DisplayName = "GDPR",
StandsFor = "General Data Protection Regulation",
Description = "A European Union (EU) regulation on data protection and privacy in the EU and the European Economic Area (EEA) that enhances individuals' control and rights over their personal data, simplifies the regulatory environment for international business, and addresses the transfer of personal data outside the EU and EEA areas.",
WebUrl = "http://contoso.com/GDPR",
State = AnswerState.Published,
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Search.Acronyms.PostAsync(requestBody);
mgc search acronyms create --body '{\
"displayName": "GDPR",\
"standsFor": "General Data Protection Regulation",\
"description": "A European Union (EU) regulation on data protection and privacy in the EU and the European Economic Area (EEA) that enhances individuals' control and rights over their personal data, simplifies the regulatory environment for international business, and addresses the transfer of personal data outside the EU and EEA areas.",\
"webUrl": "http://contoso.com/GDPR",\
"state": "published"\
}\
'
// 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"
graphmodelssearch "github.com/microsoftgraph/msgraph-sdk-go/models/search"
//other-imports
)
requestBody := graphmodelssearch.NewAcronym()
displayName := "GDPR"
requestBody.SetDisplayName(&displayName)
standsFor := "General Data Protection Regulation"
requestBody.SetStandsFor(&standsFor)
description := "A European Union (EU) regulation on data protection and privacy in the EU and the European Economic Area (EEA) that enhances individuals' control and rights over their personal data, simplifies the regulatory environment for international business, and addresses the transfer of personal data outside the EU and EEA areas."
requestBody.SetDescription(&description)
webUrl := "http://contoso.com/GDPR"
requestBody.SetWebUrl(&webUrl)
state := graphmodels.PUBLISHED_ANSWERSTATE
requestBody.SetState(&state)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
acronyms, err := graphClient.Search().Acronyms().Post(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.models.search.Acronym acronym = new com.microsoft.graph.models.search.Acronym();
acronym.setDisplayName("GDPR");
acronym.setStandsFor("General Data Protection Regulation");
acronym.setDescription("A European Union (EU) regulation on data protection and privacy in the EU and the European Economic Area (EEA) that enhances individuals' control and rights over their personal data, simplifies the regulatory environment for international business, and addresses the transfer of personal data outside the EU and EEA areas.");
acronym.setWebUrl("http://contoso.com/GDPR");
acronym.setState(com.microsoft.graph.models.search.AnswerState.Published);
com.microsoft.graph.models.search.Acronym result = graphClient.search().acronyms().post(acronym);
const options = {
authProvider,
};
const client = Client.init(options);
const acronym = {
displayName: 'GDPR',
standsFor: 'General Data Protection Regulation',
description: 'A European Union (EU) regulation on data protection and privacy in the EU and the European Economic Area (EEA) that enhances individuals\' control and rights over their personal data, simplifies the regulatory environment for international business, and addresses the transfer of personal data outside the EU and EEA areas.',
webUrl: 'http://contoso.com/GDPR',
state: 'published'
};
await client.api('/search/acronyms')
.post(acronym);
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Models\Search\Acronym;
use Microsoft\Graph\Generated\Models\Search\AnswerState;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new Acronym();
$requestBody->setDisplayName('GDPR');
$requestBody->setStandsFor('General Data Protection Regulation');
$requestBody->setDescription('A European Union (EU) regulation on data protection and privacy in the EU and the European Economic Area (EEA) that enhances individuals\' control and rights over their personal data, simplifies the regulatory environment for international business, and addresses the transfer of personal data outside the EU and EEA areas.');
$requestBody->setWebUrl('http://contoso.com/GDPR');
$requestBody->setState(new AnswerState('published'));
$result = $graphServiceClient->search()->acronyms()->post($requestBody)->wait();
Import-Module Microsoft.Graph.Search
$params = @{
displayName = "GDPR"
standsFor = "General Data Protection Regulation"
description = "A European Union (EU) regulation on data protection and privacy in the EU and the European Economic Area (EEA) that enhances individuals' control and rights over their personal data, simplifies the regulatory environment for international business, and addresses the transfer of personal data outside the EU and EEA areas."
webUrl = "http://contoso.com/GDPR"
state = "published"
}
New-MgSearchAcronym -BodyParameter $params
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
from msgraph.generated.models.search.acronym import Acronym
from msgraph.generated.models.answer_state import AnswerState
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = Acronym(
display_name = "GDPR",
stands_for = "General Data Protection Regulation",
description = "A European Union (EU) regulation on data protection and privacy in the EU and the European Economic Area (EEA) that enhances individuals' control and rights over their personal data, simplifies the regulatory environment for international business, and addresses the transfer of personal data outside the EU and EEA areas.",
web_url = "http://contoso.com/GDPR",
state = AnswerState.Published,
)
result = await graph_client.search.acronyms.post(request_body)
HTTP/1.1 201 Created
Content-Type: application/json
{
"id": "733b26d5-af76-4eea-ac69-1a0ce8716897"
}
Exemplo 2: criar um novo indicador
A solicitação a seguir cria um novo indicador que é exibido na página de resultados da pesquisa quando um usuário pesquisa pelo menos uma de suas palavras-chave.
POST https://graph.microsoft.com/v1.0/search/bookmarks
Content-Type: application/json
{
"displayName": "Contoso Install Site",
"webUrl": "http://www.contoso.com/",
"description": "Try or buy Contoso for Home or Business and view product information",
"keywords": {
"keywords": ["Contoso", "install"],
"reservedKeywords": ["Contoso"],
"matchSimilarKeywords": true
},
"state": "published"
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models.Search;
var requestBody = new Bookmark
{
DisplayName = "Contoso Install Site",
WebUrl = "http://www.contoso.com/",
Description = "Try or buy Contoso for Home or Business and view product information",
Keywords = new AnswerKeyword
{
Keywords = new List<string>
{
"Contoso",
"install",
},
ReservedKeywords = new List<string>
{
"Contoso",
},
MatchSimilarKeywords = true,
},
State = AnswerState.Published,
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Search.Bookmarks.PostAsync(requestBody);
// 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"
graphmodelssearch "github.com/microsoftgraph/msgraph-sdk-go/models/search"
//other-imports
)
requestBody := graphmodelssearch.NewBookmark()
displayName := "Contoso Install Site"
requestBody.SetDisplayName(&displayName)
webUrl := "http://www.contoso.com/"
requestBody.SetWebUrl(&webUrl)
description := "Try or buy Contoso for Home or Business and view product information"
requestBody.SetDescription(&description)
keywords := graphmodelssearch.NewAnswerKeyword()
keywords := []string {
"Contoso",
"install",
}
keywords.SetKeywords(keywords)
reservedKeywords := []string {
"Contoso",
}
keywords.SetReservedKeywords(reservedKeywords)
matchSimilarKeywords := true
keywords.SetMatchSimilarKeywords(&matchSimilarKeywords)
requestBody.SetKeywords(keywords)
state := graphmodels.PUBLISHED_ANSWERSTATE
requestBody.SetState(&state)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
bookmarks, err := graphClient.Search().Bookmarks().Post(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.models.search.Bookmark bookmark = new com.microsoft.graph.models.search.Bookmark();
bookmark.setDisplayName("Contoso Install Site");
bookmark.setWebUrl("http://www.contoso.com/");
bookmark.setDescription("Try or buy Contoso for Home or Business and view product information");
com.microsoft.graph.models.search.AnswerKeyword keywords = new com.microsoft.graph.models.search.AnswerKeyword();
LinkedList<String> keywords1 = new LinkedList<String>();
keywords1.add("Contoso");
keywords1.add("install");
keywords.setKeywords(keywords1);
LinkedList<String> reservedKeywords = new LinkedList<String>();
reservedKeywords.add("Contoso");
keywords.setReservedKeywords(reservedKeywords);
keywords.setMatchSimilarKeywords(true);
bookmark.setKeywords(keywords);
bookmark.setState(com.microsoft.graph.models.search.AnswerState.Published);
com.microsoft.graph.models.search.Bookmark result = graphClient.search().bookmarks().post(bookmark);
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Models\Search\Bookmark;
use Microsoft\Graph\Generated\Models\Search\AnswerKeyword;
use Microsoft\Graph\Generated\Models\Search\AnswerState;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new Bookmark();
$requestBody->setDisplayName('Contoso Install Site');
$requestBody->setWebUrl('http://www.contoso.com/');
$requestBody->setDescription('Try or buy Contoso for Home or Business and view product information');
$keywords = new AnswerKeyword();
$keywords->setKeywords(['Contoso', 'install', ]);
$keywords->setReservedKeywords(['Contoso', ]);
$keywords->setMatchSimilarKeywords(true);
$requestBody->setKeywords($keywords);
$requestBody->setState(new AnswerState('published'));
$result = $graphServiceClient->search()->bookmarks()->post($requestBody)->wait();
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
from msgraph.generated.models.search.bookmark import Bookmark
from msgraph.generated.models.search.answer_keyword import AnswerKeyword
from msgraph.generated.models.answer_state import AnswerState
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = Bookmark(
display_name = "Contoso Install Site",
web_url = "http://www.contoso.com/",
description = "Try or buy Contoso for Home or Business and view product information",
keywords = AnswerKeyword(
keywords = [
"Contoso",
"install",
],
reserved_keywords = [
"Contoso",
],
match_similar_keywords = True,
),
state = AnswerState.Published,
)
result = await graph_client.search.bookmarks.post(request_body)