POST https://graph.microsoft.com/beta/search/qnas
Content-Type: application/json
{
"displayName": "Global Country Holidays",
"webUrl": "http://www.contoso.com/",
"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. <table> <thead> <tr> <td><strong>2021 Dates</strong></td> <td><strong>Holiday</strong></td> </tr> </thead> <tbody> <tr> <td>January 1, 2021</td> <td>New Year's Day</td> </tr> <tr> <td>January 18, 2021</td> <td>Martin Luther King Day</td> </tr> <tr> <td>February 15, 2021</td> <td>Presidents Day</td> </tr> <tr> <td>May 31, 2021</td> <td>Memorial Day</td> </tr> <tr> <td>July 5, 2021</td> <td>Independence Day</td> </tr> <tr> <td>September 6, 2021</td> <td>Labor Day</td> </tr> <tr> <td>November 25, 2021 - November 26, 2021</td> <td>Thanksgiving Day and Day after Thanksgiving</td> </tr> <tr> <td>December 23, 2021 - December 24, 2021</td> <td>Christmas Eve and Christmas Day</td> </tr> </tbody> </table>",
"keywords": {
"keywords": ["new years day", "martin luther king day", "presidents day", "memorial day", "independence day", "labor day", "thanksgiving", "christmas"],
"reservedKeywords": ["holidays", "paid days off"],
"matchSimilarKeywords": true
},
"availabilityStartDateTime": "2020-09-21T20:01:37Z",
"availabilityEndDateTime": "2021-12-31T20:01:37Z",
"languageTags": ["en-us"],
"platforms": ["ios"],
"state": "published"
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models.Search;
using Microsoft.Graph.Beta.Models;
var requestBody = new Qna
{
DisplayName = "Global Country Holidays",
WebUrl = "http://www.contoso.com/",
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. <table> <thead> <tr> <td><strong>2021 Dates</strong></td> <td><strong>Holiday</strong></td> </tr> </thead> <tbody> <tr> <td>January 1, 2021</td> <td>New Year's Day</td> </tr> <tr> <td>January 18, 2021</td> <td>Martin Luther King Day</td> </tr> <tr> <td>February 15, 2021</td> <td>Presidents Day</td> </tr> <tr> <td>May 31, 2021</td> <td>Memorial Day</td> </tr> <tr> <td>July 5, 2021</td> <td>Independence Day</td> </tr> <tr> <td>September 6, 2021</td> <td>Labor Day</td> </tr> <tr> <td>November 25, 2021 - November 26, 2021</td> <td>Thanksgiving Day and Day after Thanksgiving</td> </tr> <tr> <td>December 23, 2021 - December 24, 2021</td> <td>Christmas Eve and Christmas Day</td> </tr> </tbody> </table>",
Keywords = new AnswerKeyword
{
Keywords = new List<string>
{
"new years day",
"martin luther king day",
"presidents day",
"memorial day",
"independence day",
"labor day",
"thanksgiving",
"christmas",
},
ReservedKeywords = new List<string>
{
"holidays",
"paid days off",
},
MatchSimilarKeywords = true,
},
AvailabilityStartDateTime = DateTimeOffset.Parse("2020-09-21T20:01:37Z"),
AvailabilityEndDateTime = DateTimeOffset.Parse("2021-12-31T20:01:37Z"),
LanguageTags = new List<string>
{
"en-us",
},
Platforms = new List<DevicePlatformType?>
{
DevicePlatformType.IOS,
},
State = AnswerState.Published,
};
// To initialize your graphClient, see https://video2.skills-academy.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Search.Qnas.PostAsync(requestBody);
mgc-beta search qnas create --body '{\
"displayName": "Global Country Holidays",\
"webUrl": "http://www.contoso.com/",\
"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. <table> <thead> <tr> <td><strong>2021 Dates</strong></td> <td><strong>Holiday</strong></td> </tr> </thead> <tbody> <tr> <td>January 1, 2021</td> <td>New Year's Day</td> </tr> <tr> <td>January 18, 2021</td> <td>Martin Luther King Day</td> </tr> <tr> <td>February 15, 2021</td> <td>Presidents Day</td> </tr> <tr> <td>May 31, 2021</td> <td>Memorial Day</td> </tr> <tr> <td>July 5, 2021</td> <td>Independence Day</td> </tr> <tr> <td>September 6, 2021</td> <td>Labor Day</td> </tr> <tr> <td>November 25, 2021 - November 26, 2021</td> <td>Thanksgiving Day and Day after Thanksgiving</td> </tr> <tr> <td>December 23, 2021 - December 24, 2021</td> <td>Christmas Eve and Christmas Day</td> </tr> </tbody> </table>",\
"keywords": {\
"keywords": ["new years day", "martin luther king day", "presidents day", "memorial day", "independence day", "labor day", "thanksgiving", "christmas"],\
"reservedKeywords": ["holidays", "paid days off"],\
"matchSimilarKeywords": true\
},\
"availabilityStartDateTime": "2020-09-21T20:01:37Z",\
"availabilityEndDateTime": "2021-12-31T20:01:37Z",\
"languageTags": ["en-us"],\
"platforms": ["ios"],\
"state": "published"\
}\
'
// Code snippets are only available for the latest major version. Current major version is $v0.*
// Dependencies
import (
"context"
"time"
msgraphsdk "github.com/microsoftgraph/msgraph-beta-sdk-go"
graphmodelssearch "github.com/microsoftgraph/msgraph-beta-sdk-go/models/search"
graphmodels "github.com/microsoftgraph/msgraph-beta-sdk-go/models"
//other-imports
)
requestBody := graphmodelssearch.NewQna()
displayName := "Global Country Holidays"
requestBody.SetDisplayName(&displayName)
webUrl := "http://www.contoso.com/"
requestBody.SetWebUrl(&webUrl)
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. <table> <thead> <tr> <td><strong>2021 Dates</strong></td> <td><strong>Holiday</strong></td> </tr> </thead> <tbody> <tr> <td>January 1, 2021</td> <td>New Year's Day</td> </tr> <tr> <td>January 18, 2021</td> <td>Martin Luther King Day</td> </tr> <tr> <td>February 15, 2021</td> <td>Presidents Day</td> </tr> <tr> <td>May 31, 2021</td> <td>Memorial Day</td> </tr> <tr> <td>July 5, 2021</td> <td>Independence Day</td> </tr> <tr> <td>September 6, 2021</td> <td>Labor Day</td> </tr> <tr> <td>November 25, 2021 - November 26, 2021</td> <td>Thanksgiving Day and Day after Thanksgiving</td> </tr> <tr> <td>December 23, 2021 - December 24, 2021</td> <td>Christmas Eve and Christmas Day</td> </tr> </tbody> </table>"
requestBody.SetDescription(&description)
keywords := graphmodelssearch.NewAnswerKeyword()
keywords := []string {
"new years day",
"martin luther king day",
"presidents day",
"memorial day",
"independence day",
"labor day",
"thanksgiving",
"christmas",
}
keywords.SetKeywords(keywords)
reservedKeywords := []string {
"holidays",
"paid days off",
}
keywords.SetReservedKeywords(reservedKeywords)
matchSimilarKeywords := true
keywords.SetMatchSimilarKeywords(&matchSimilarKeywords)
requestBody.SetKeywords(keywords)
availabilityStartDateTime , err := time.Parse(time.RFC3339, "2020-09-21T20:01:37Z")
requestBody.SetAvailabilityStartDateTime(&availabilityStartDateTime)
availabilityEndDateTime , err := time.Parse(time.RFC3339, "2021-12-31T20:01:37Z")
requestBody.SetAvailabilityEndDateTime(&availabilityEndDateTime)
languageTags := []string {
"en-us",
}
requestBody.SetLanguageTags(languageTags)
platforms := []graphmodels.DevicePlatformTypeable {
devicePlatformType := graphmodels.IOS_DEVICEPLATFORMTYPE
requestBody.SetDevicePlatformType(&devicePlatformType)
}
requestBody.SetPlatforms(platforms)
state := graphmodels.PUBLISHED_ANSWERSTATE
requestBody.SetState(&state)
// To initialize your graphClient, see https://video2.skills-academy.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
qnas, err := graphClient.Search().Qnas().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.beta.models.search.Qna qna = new com.microsoft.graph.beta.models.search.Qna();
qna.setDisplayName("Global Country Holidays");
qna.setWebUrl("http://www.contoso.com/");
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. <table> <thead> <tr> <td><strong>2021 Dates</strong></td> <td><strong>Holiday</strong></td> </tr> </thead> <tbody> <tr> <td>January 1, 2021</td> <td>New Year's Day</td> </tr> <tr> <td>January 18, 2021</td> <td>Martin Luther King Day</td> </tr> <tr> <td>February 15, 2021</td> <td>Presidents Day</td> </tr> <tr> <td>May 31, 2021</td> <td>Memorial Day</td> </tr> <tr> <td>July 5, 2021</td> <td>Independence Day</td> </tr> <tr> <td>September 6, 2021</td> <td>Labor Day</td> </tr> <tr> <td>November 25, 2021 - November 26, 2021</td> <td>Thanksgiving Day and Day after Thanksgiving</td> </tr> <tr> <td>December 23, 2021 - December 24, 2021</td> <td>Christmas Eve and Christmas Day</td> </tr> </tbody> </table>");
com.microsoft.graph.beta.models.search.AnswerKeyword keywords = new com.microsoft.graph.beta.models.search.AnswerKeyword();
LinkedList<String> keywords1 = new LinkedList<String>();
keywords1.add("new years day");
keywords1.add("martin luther king day");
keywords1.add("presidents day");
keywords1.add("memorial day");
keywords1.add("independence day");
keywords1.add("labor day");
keywords1.add("thanksgiving");
keywords1.add("christmas");
keywords.setKeywords(keywords1);
LinkedList<String> reservedKeywords = new LinkedList<String>();
reservedKeywords.add("holidays");
reservedKeywords.add("paid days off");
keywords.setReservedKeywords(reservedKeywords);
keywords.setMatchSimilarKeywords(true);
qna.setKeywords(keywords);
OffsetDateTime availabilityStartDateTime = OffsetDateTime.parse("2020-09-21T20:01:37Z");
qna.setAvailabilityStartDateTime(availabilityStartDateTime);
OffsetDateTime availabilityEndDateTime = OffsetDateTime.parse("2021-12-31T20:01:37Z");
qna.setAvailabilityEndDateTime(availabilityEndDateTime);
LinkedList<String> languageTags = new LinkedList<String>();
languageTags.add("en-us");
qna.setLanguageTags(languageTags);
LinkedList<DevicePlatformType> platforms = new LinkedList<DevicePlatformType>();
platforms.add(DevicePlatformType.IOS);
qna.setPlatforms(platforms);
qna.setState(com.microsoft.graph.beta.models.search.AnswerState.Published);
com.microsoft.graph.models.search.Qna result = graphClient.search().qnas().post(qna);
const options = {
authProvider,
};
const client = Client.init(options);
const qna = {
displayName: 'Global Country Holidays',
webUrl: 'http://www.contoso.com/',
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. <table> <thead> <tr> <td><strong>2021 Dates</strong></td> <td><strong>Holiday</strong></td> </tr> </thead> <tbody> <tr> <td>January 1, 2021</td> <td>New Year\'s Day</td> </tr> <tr> <td>January 18, 2021</td> <td>Martin Luther King Day</td> </tr> <tr> <td>February 15, 2021</td> <td>Presidents Day</td> </tr> <tr> <td>May 31, 2021</td> <td>Memorial Day</td> </tr> <tr> <td>July 5, 2021</td> <td>Independence Day</td> </tr> <tr> <td>September 6, 2021</td> <td>Labor Day</td> </tr> <tr> <td>November 25, 2021 - November 26, 2021</td> <td>Thanksgiving Day and Day after Thanksgiving</td> </tr> <tr> <td>December 23, 2021 - December 24, 2021</td> <td>Christmas Eve and Christmas Day</td> </tr> </tbody> </table>',
keywords: {
keywords: ['new years day', 'martin luther king day', 'presidents day', 'memorial day', 'independence day', 'labor day', 'thanksgiving', 'christmas'],
reservedKeywords: ['holidays', 'paid days off'],
matchSimilarKeywords: true
},
availabilityStartDateTime: '2020-09-21T20:01:37Z',
availabilityEndDateTime: '2021-12-31T20:01:37Z',
languageTags: ['en-us'],
platforms: ['ios'],
state: 'published'
};
await client.api('/search/qnas')
.version('beta')
.post(qna);
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Models\Search\Qna;
use Microsoft\Graph\Beta\Generated\Models\Search\AnswerKeyword;
use Microsoft\Graph\Beta\Generated\Models\DevicePlatformType;
use Microsoft\Graph\Beta\Generated\Models\Search\AnswerState;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new Qna();
$requestBody->setDisplayName('Global Country Holidays');
$requestBody->setWebUrl('http://www.contoso.com/');
$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. <table> <thead> <tr> <td><strong>2021 Dates</strong></td> <td><strong>Holiday</strong></td> </tr> </thead> <tbody> <tr> <td>January 1, 2021</td> <td>New Year\'s Day</td> </tr> <tr> <td>January 18, 2021</td> <td>Martin Luther King Day</td> </tr> <tr> <td>February 15, 2021</td> <td>Presidents Day</td> </tr> <tr> <td>May 31, 2021</td> <td>Memorial Day</td> </tr> <tr> <td>July 5, 2021</td> <td>Independence Day</td> </tr> <tr> <td>September 6, 2021</td> <td>Labor Day</td> </tr> <tr> <td>November 25, 2021 - November 26, 2021</td> <td>Thanksgiving Day and Day after Thanksgiving</td> </tr> <tr> <td>December 23, 2021 - December 24, 2021</td> <td>Christmas Eve and Christmas Day</td> </tr> </tbody> </table>');
$keywords = new AnswerKeyword();
$keywords->setKeywords(['new years day', 'martin luther king day', 'presidents day', 'memorial day', 'independence day', 'labor day', 'thanksgiving', 'christmas', ]);
$keywords->setReservedKeywords(['holidays', 'paid days off', ]);
$keywords->setMatchSimilarKeywords(true);
$requestBody->setKeywords($keywords);
$requestBody->setAvailabilityStartDateTime(new \DateTime('2020-09-21T20:01:37Z'));
$requestBody->setAvailabilityEndDateTime(new \DateTime('2021-12-31T20:01:37Z'));
$requestBody->setLanguageTags(['en-us', ]);
$requestBody->setPlatforms([new DevicePlatformType('ios'), ]);
$requestBody->setState(new AnswerState('published'));
$result = $graphServiceClient->search()->qnas()->post($requestBody)->wait();
Import-Module Microsoft.Graph.Beta.Search
$params = @{
displayName = "Global Country Holidays"
webUrl = "http://www.contoso.com/"
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. <table> <thead> <tr> <td><strong>2021 Dates</strong></td> <td><strong>Holiday</strong></td> </tr> </thead> <tbody> <tr> <td>January 1, 2021</td> <td>New Year's Day</td> </tr> <tr> <td>January 18, 2021</td> <td>Martin Luther King Day</td> </tr> <tr> <td>February 15, 2021</td> <td>Presidents Day</td> </tr> <tr> <td>May 31, 2021</td> <td>Memorial Day</td> </tr> <tr> <td>July 5, 2021</td> <td>Independence Day</td> </tr> <tr> <td>September 6, 2021</td> <td>Labor Day</td> </tr> <tr> <td>November 25, 2021 - November 26, 2021</td> <td>Thanksgiving Day and Day after Thanksgiving</td> </tr> <tr> <td>December 23, 2021 - December 24, 2021</td> <td>Christmas Eve and Christmas Day</td> </tr> </tbody> </table>"
keywords = @{
keywords = @(
"new years day"
"martin luther king day"
"presidents day"
"memorial day"
"independence day"
"labor day"
"thanksgiving"
"christmas"
)
reservedKeywords = @(
"holidays"
"paid days off"
)
matchSimilarKeywords = $true
}
availabilityStartDateTime = [System.DateTime]::Parse("2020-09-21T20:01:37Z")
availabilityEndDateTime = [System.DateTime]::Parse("2021-12-31T20:01:37Z")
languageTags = @(
"en-us"
)
platforms = @(
"ios"
)
state = "published"
}
New-MgBetaSearchQna -BodyParameter $params
from msgraph_beta import GraphServiceClient
from msgraph_beta.generated.models.search.qna import Qna
from msgraph_beta.generated.models.search.answer_keyword import AnswerKeyword
from msgraph_beta.generated.models.device_platform_type import DevicePlatformType
from msgraph_beta.generated.models.answer_state import AnswerState
graph_client = GraphServiceClient(credentials, scopes)
request_body = Qna(
display_name = "Global Country Holidays",
web_url = "http://www.contoso.com/",
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. <table> <thead> <tr> <td><strong>2021 Dates</strong></td> <td><strong>Holiday</strong></td> </tr> </thead> <tbody> <tr> <td>January 1, 2021</td> <td>New Year's Day</td> </tr> <tr> <td>January 18, 2021</td> <td>Martin Luther King Day</td> </tr> <tr> <td>February 15, 2021</td> <td>Presidents Day</td> </tr> <tr> <td>May 31, 2021</td> <td>Memorial Day</td> </tr> <tr> <td>July 5, 2021</td> <td>Independence Day</td> </tr> <tr> <td>September 6, 2021</td> <td>Labor Day</td> </tr> <tr> <td>November 25, 2021 - November 26, 2021</td> <td>Thanksgiving Day and Day after Thanksgiving</td> </tr> <tr> <td>December 23, 2021 - December 24, 2021</td> <td>Christmas Eve and Christmas Day</td> </tr> </tbody> </table>",
keywords = AnswerKeyword(
keywords = [
"new years day",
"martin luther king day",
"presidents day",
"memorial day",
"independence day",
"labor day",
"thanksgiving",
"christmas",
],
reserved_keywords = [
"holidays",
"paid days off",
],
match_similar_keywords = True,
),
availability_start_date_time = "2020-09-21T20:01:37Z",
availability_end_date_time = "2021-12-31T20:01:37Z",
language_tags = [
"en-us",
],
platforms = [
DevicePlatformType.IOS,
],
state = AnswerState.Published,
)
result = await graph_client.search.qnas.post(request_body)