// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Communications.Calls.Item.PlayPrompt;
using Microsoft.Graph.Beta.Models;
var requestBody = new PlayPromptPostRequestBody
{
ClientContext = "d45324c1-fcb5-430a-902c-f20af696537c",
Prompts = new List<Prompt>
{
new MediaPrompt
{
OdataType = "#microsoft.graph.mediaPrompt",
MediaInfo = new MediaInfo
{
OdataType = "#microsoft.graph.mediaInfo",
Uri = "https://cdn.contoso.com/beep.wav",
ResourceId = "1D6DE2D4-CD51-4309-8DAA-70768651088E",
},
},
},
Loop = false,
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Communications.Calls["{call-id}"].PlayPrompt.PostAsync(requestBody);
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
com.microsoft.graph.beta.communications.calls.item.playprompt.PlayPromptPostRequestBody playPromptPostRequestBody = new com.microsoft.graph.beta.communications.calls.item.playprompt.PlayPromptPostRequestBody();
playPromptPostRequestBody.setClientContext("d45324c1-fcb5-430a-902c-f20af696537c");
LinkedList<Prompt> prompts = new LinkedList<Prompt>();
MediaPrompt prompt = new MediaPrompt();
prompt.setOdataType("#microsoft.graph.mediaPrompt");
MediaInfo mediaInfo = new MediaInfo();
mediaInfo.setOdataType("#microsoft.graph.mediaInfo");
mediaInfo.setUri("https://cdn.contoso.com/beep.wav");
mediaInfo.setResourceId("1D6DE2D4-CD51-4309-8DAA-70768651088E");
prompt.setMediaInfo(mediaInfo);
prompts.add(prompt);
playPromptPostRequestBody.setPrompts(prompts);
playPromptPostRequestBody.setLoop(false);
var result = graphClient.communications().calls().byCallId("{call-id}").playPrompt().post(playPromptPostRequestBody);
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Communications\Calls\Item\PlayPrompt\PlayPromptPostRequestBody;
use Microsoft\Graph\Beta\Generated\Models\Prompt;
use Microsoft\Graph\Beta\Generated\Models\MediaPrompt;
use Microsoft\Graph\Beta\Generated\Models\MediaInfo;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new PlayPromptPostRequestBody();
$requestBody->setClientContext('d45324c1-fcb5-430a-902c-f20af696537c');
$promptsPrompt1 = new MediaPrompt();
$promptsPrompt1->setOdataType('#microsoft.graph.mediaPrompt');
$promptsPrompt1MediaInfo = new MediaInfo();
$promptsPrompt1MediaInfo->setOdataType('#microsoft.graph.mediaInfo');
$promptsPrompt1MediaInfo->setUri('https://cdn.contoso.com/beep.wav');
$promptsPrompt1MediaInfo->setResourceId('1D6DE2D4-CD51-4309-8DAA-70768651088E');
$promptsPrompt1->setMediaInfo($promptsPrompt1MediaInfo);
$promptsArray []= $promptsPrompt1;
$requestBody->setPrompts($promptsArray);
$requestBody->setLoop(false);
$result = $graphServiceClient->communications()->calls()->byCallId('call-id')->playPrompt()->post($requestBody)->wait();
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
from msgraph_beta.generated.communications.calls.item.play_prompt.play_prompt_post_request_body import PlayPromptPostRequestBody
from msgraph_beta.generated.models.prompt import Prompt
from msgraph_beta.generated.models.media_prompt import MediaPrompt
from msgraph_beta.generated.models.media_info import MediaInfo
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = PlayPromptPostRequestBody(
client_context = "d45324c1-fcb5-430a-902c-f20af696537c",
prompts = [
MediaPrompt(
odata_type = "#microsoft.graph.mediaPrompt",
media_info = MediaInfo(
odata_type = "#microsoft.graph.mediaInfo",
uri = "https://cdn.contoso.com/beep.wav",
resource_id = "1D6DE2D4-CD51-4309-8DAA-70768651088E",
),
),
],
loop = False,
)
result = await graph_client.communications.calls.by_call_id('call-id').play_prompt.post(request_body)