Open extensions doesnt seem to work as intended with events

jesper jakobsen 1 Reputation point
2022-01-04T10:39:15.343+00:00

When getting the event again with extensions is throws the error
{"error":{"code":"ErrorInvalidRequest","message":"The OData request is not supported."}}

and since your documentation does say its supported for calender events im wondering if im doing something wrong, or if its straight out a bug

var meeting = new Event
{
Subject = "test meeting",
Start = new DateTimeTimeZone
{
DateTime = DateTime.Now.ToString("o", CultureInfo.InvariantCulture),
TimeZone = "UTC"
},
End = new DateTimeTimeZone
{
DateTime = DateTime.Now.AddHours(1).ToString("o", CultureInfo.InvariantCulture),
TimeZone = "UTC"
},
Attendees = new Attendee[]
{
new Attendee { EmailAddress = new EmailAddress { Address = "email@rayn "}}
}
};
var extensionData = new OpenTypeExtension
{
ExtensionName = "custom_id",
AdditionalData = new Dictionary<string, object>
{
{ "customId", "123456-125235-23-523-5-235-423" }
}
};
var meet = await client.Me.Events.Request().AddAsync(meeting);
await client.Me.Events[meet.Id].Extensions.Request().AddAsync(extensionData);
var @event = await client.Me.Events[meet.Id].Extensions.Request().GetAsync(); //throws error here

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,582 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. jesper jakobsen 1 Reputation point
    2022-01-10T13:36:26.66+00:00

    The solution is simply to specifiy what extension it is you want so
    var @event = await client.Me.Events[meet.Id].Extensions["custom_id"].Request().GetAsync(); //throws error here
    instead of
    var @event = await client.Me.Events[meet.Id].Extensions.Request().GetAsync(); //throws error here

    0 comments No comments