Choose the permission or permissions marked as least privileged for this API. Use a higher privileged permission or permissions only if your app requires it. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference.
The following example shows a request.
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": ["Unique keyword"],
"matchSimilarKeywords": true
},
"availabilityStartDateTime": null,
"availabilityEndDateTime": null,
"platforms": ["windows"],
"targetedVariations": [
{
"languageTag": "es-es",
"displayName": "Sitio de instalación Contoso",
"description": "Pruebe o compre Contoso hogar o negocios y vea la información del producto"
}
],
"state": "published"
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models.Search;
using Microsoft.Graph.Models;
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>
{
"Unique keyword",
},
MatchSimilarKeywords = true,
},
AvailabilityStartDateTime = null,
AvailabilityEndDateTime = null,
Platforms = new List<DevicePlatformType?>
{
DevicePlatformType.Android,
},
TargetedVariations = new List<AnswerVariant>
{
new AnswerVariant
{
LanguageTag = "es-es",
DisplayName = "Sitio de instalación Contoso",
Description = "Pruebe o compre Contoso hogar o negocios y vea la información del producto",
},
},
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);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
mgc search bookmarks create --body '{\
"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": ["Unique keyword"],\
"matchSimilarKeywords": true\
},\
"availabilityStartDateTime": null,\
"availabilityEndDateTime": null,\
"platforms": ["windows"],\
"targetedVariations": [\
{\
"languageTag": "es-es",\
"displayName": "Sitio de instalación Contoso",\
"description": "Pruebe o compre Contoso hogar o negocios y vea la información del producto"\
}\
],\
"state": "published"\
}\
'
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
// 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"
graphmodels "github.com/microsoftgraph/msgraph-sdk-go/models"
//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 {
"Unique keyword",
}
keywords.SetReservedKeywords(reservedKeywords)
matchSimilarKeywords := true
keywords.SetMatchSimilarKeywords(&matchSimilarKeywords)
requestBody.SetKeywords(keywords)
availabilityStartDateTime := null
requestBody.SetAvailabilityStartDateTime(&availabilityStartDateTime)
availabilityEndDateTime := null
requestBody.SetAvailabilityEndDateTime(&availabilityEndDateTime)
platforms := []graphmodels.DevicePlatformTypeable {
devicePlatformType := graphmodels.WINDOWS_DEVICEPLATFORMTYPE
requestBody.SetDevicePlatformType(&devicePlatformType)
}
requestBody.SetPlatforms(platforms)
answerVariant := graphmodelssearch.NewAnswerVariant()
languageTag := "es-es"
answerVariant.SetLanguageTag(&languageTag)
displayName := "Sitio de instalación Contoso"
answerVariant.SetDisplayName(&displayName)
description := "Pruebe o compre Contoso hogar o negocios y vea la información del producto"
answerVariant.SetDescription(&description)
targetedVariations := []graphmodelssearch.AnswerVariantable {
answerVariant,
}
requestBody.SetTargetedVariations(targetedVariations)
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)
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
// 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("Unique keyword");
keywords.setReservedKeywords(reservedKeywords);
keywords.setMatchSimilarKeywords(true);
bookmark.setKeywords(keywords);
bookmark.setAvailabilityStartDateTime(null);
bookmark.setAvailabilityEndDateTime(null);
LinkedList<DevicePlatformType> platforms = new LinkedList<DevicePlatformType>();
platforms.add(DevicePlatformType.Android);
bookmark.setPlatforms(platforms);
LinkedList<com.microsoft.graph.models.search.AnswerVariant> targetedVariations = new LinkedList<com.microsoft.graph.models.search.AnswerVariant>();
com.microsoft.graph.models.search.AnswerVariant answerVariant = new com.microsoft.graph.models.search.AnswerVariant();
answerVariant.setLanguageTag("es-es");
answerVariant.setDisplayName("Sitio de instalación Contoso");
answerVariant.setDescription("Pruebe o compre Contoso hogar o negocios y vea la información del producto");
targetedVariations.add(answerVariant);
bookmark.setTargetedVariations(targetedVariations);
bookmark.setState(com.microsoft.graph.models.search.AnswerState.Published);
com.microsoft.graph.models.search.Bookmark result = graphClient.search().bookmarks().post(bookmark);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
const options = {
authProvider,
};
const client = Client.init(options);
const bookmark = {
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: ['Unique keyword'],
matchSimilarKeywords: true
},
availabilityStartDateTime: null,
availabilityEndDateTime: null,
platforms: ['windows'],
targetedVariations: [
{
languageTag: 'es-es',
displayName: 'Sitio de instalación Contoso',
description: 'Pruebe o compre Contoso hogar o negocios y vea la información del producto'
}
],
state: 'published'
};
await client.api('/search/bookmarks')
.post(bookmark);
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Models\Search\Bookmark;
use Microsoft\Graph\Generated\Models\Search\AnswerKeyword;
use Microsoft\Graph\Generated\Models\DevicePlatformType;
use Microsoft\Graph\Generated\Models\Search\AnswerVariant;
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(['Unique keyword', ]);
$keywords->setMatchSimilarKeywords(true);
$requestBody->setKeywords($keywords);
$requestBody->setAvailabilityStartDateTime(null);
$requestBody->setAvailabilityEndDateTime(null);
$requestBody->setPlatforms([new DevicePlatformType('windows'), ]);
$targetedVariationsAnswerVariant1 = new AnswerVariant();
$targetedVariationsAnswerVariant1->setLanguageTag('es-es');
$targetedVariationsAnswerVariant1->setDisplayName('Sitio de instalación Contoso');
$targetedVariationsAnswerVariant1->setDescription('Pruebe o compre Contoso hogar o negocios y vea la información del producto');
$targetedVariationsArray []= $targetedVariationsAnswerVariant1;
$requestBody->setTargetedVariations($targetedVariationsArray);
$requestBody->setState(new AnswerState('published'));
$result = $graphServiceClient->search()->bookmarks()->post($requestBody)->wait();
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
Import-Module Microsoft.Graph.Search
$params = @{
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 = @(
"Unique keyword"
)
matchSimilarKeywords = $true
}
availabilityStartDateTime = $null
availabilityEndDateTime = $null
platforms = @(
"windows"
)
targetedVariations = @(
@{
languageTag = "es-es"
displayName = "Sitio de instalación Contoso"
description = "Pruebe o compre Contoso hogar o negocios y vea la información del producto"
}
)
state = "published"
}
New-MgSearchBookmark -BodyParameter $params
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
# 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.device_platform_type import DevicePlatformType
from msgraph.generated.models.search.answer_variant import AnswerVariant
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 = [
"Unique keyword",
],
match_similar_keywords = True,
),
availability_start_date_time = None,
availability_end_date_time = None,
platforms = [
DevicePlatformType.Android,
],
targeted_variations = [
AnswerVariant(
language_tag = "es-es",
display_name = "Sitio de instalación Contoso",
description = "Pruebe o compre Contoso hogar o negocios y vea la información del producto",
),
],
state = AnswerState.Published,
)
result = await graph_client.search.bookmarks.post(request_body)
For details about how to add the SDK to your project and create an authProvider instance, see the SDK documentation.
The following example shows the response.