Ok I have the following C# code used in a console app:
var deviceCodeCredential = new DeviceCodeCredential(new DeviceCodeCredentialOptions
{
AuthorityHost = AzureAuthorityHosts.AzurePublicCloud,
ClientId = AzureClientID,
TenantId = AzureTenantID,
DeviceCodeCallback = (code, cancellation) =>
{
Console.WriteLine(code.Message);
return Task.FromResult(0);
}
});
var graphClient = new GraphServiceClient(deviceCodeCredential,
new[] { "User.Read", "OnlineMeetingTranscript.Read.All" });
var meeting = await graphClient.Me.OnlineMeetings.GetAsync((requestConfiguration) =>
{
requestConfiguration.QueryParameters.Filter = "joinWebUrl eq '" + TeamsURL + "'";
});
var transcript = await graphClient.Me.OnlineMeetings[meeting.Value[0].Id].Transcripts.GetAsync();
var transcriptText = await graphClient.Me.OnlineMeetings[meeting.Value[0].Id].Transcripts[transcript.Value[0].Id].Content.GetAsync((requestConfiguration) =>
{
requestConfiguration.Headers.Add("Content-Type", "text/vtt");
});
/*
API Docuementation suggests I do this: https://learn.microsoft.com/en-us/graph/api/calltranscript-get?view=graph-rest-1.0&tabs=csharp#example-2-get-a-calltranscript-content
However the "QueryParameters" returned is of type "DefaultQueryParameters"(which appears to be empty), so the for "Format" property does exist and the code won't build
var transcriptText = await graphClient.Me.OnlineMeetings[meeting.Value[0].Id].Transcripts[transcript.Value[0].Id].Content.GetAsync((requestConfiguration) =>
{
requestConfiguration.QueryParameters.Format = "text/vtt";
});
*/
However when I run this instead of receiving the transcript, I receive the following error:
Invalid format 'application/octet-stream, application/json' specified.
How do I work around this, how can I instruct the graph API to expect a "application/octet-stream" output from the API.
Initially, I too got same error when I ran your code in my environment to get call transcript content:
To resolve the error, make use of below modified code that gives online meeting transcript content in console like this:
using System.Text;
using Azure.Identity;
using Microsoft.Graph;
using Microsoft.Graph.Models.ODataErrors;
namespace MSOnlineMeeting
{
class Program
{
static async Task Main(string[] args)
{
var scopes = new[] { "User.Read", "OnlineMeetingTranscript.Read.All", "OnlineMeetings.Read" };
var AzureTenantID = "tenantId";
var AzureClientID = "appId";
var options = new DeviceCodeCredentialOptions
{
AuthorityHost = AzureAuthorityHosts.AzurePublicCloud,
ClientId = AzureClientID,
TenantId = AzureTenantID,
DeviceCodeCallback = (code, cancellation) =>
{
Console.WriteLine(code.Message);
return Task.FromResult(0);
},
};
var deviceCodeCredential = new DeviceCodeCredential(options);
var graphClient = new GraphServiceClient(deviceCodeCredential, scopes);
try
{
var meetings = await graphClient.Me.OnlineMeetings.GetAsync((requestConfiguration) =>
{
requestConfiguration.QueryParameters.Filter = "joinWebUrl eq 'URL'";
});
if (meetings.Value.Count == 0)
{
Console.WriteLine("No meetings found.");
return;
}
var meetingId = meetings.Value[0].Id;
var transcripts = await graphClient.Me.OnlineMeetings[meetingId].Transcripts.GetAsync();
if (transcripts.Value.Count == 0)
{
Console.WriteLine("No transcripts found.");
return;
}
var transcriptId = transcripts.Value[0].Id;
var transcriptContentStream = await graphClient.Me.OnlineMeetings[meetingId].Transcripts[transcriptId].Content.GetAsync((requestConfiguration) =>
{
requestConfiguration.Headers.Add("Accept", "text/vtt");
});
using (var memoryStream = new MemoryStream())
{
await transcriptContentStream.CopyToAsync(memoryStream);
string transcriptText = Encoding.UTF8.GetString(memoryStream.ToArray());
Console.WriteLine(transcriptText);
}
}
catch (ODataError odataError)
{
Console.WriteLine($"Error Code: {odataError.Error.Code}");
Console.WriteLine($"Error Message: {odataError.Error.Message}");
}
}
}
}
Response:
Reference: Get callTranscript - Microsoft Graph v1.0