When using singleValueExtendedProperties - Can I get all singleValueExtendedProperties that exist for an event and include them in the API response?

Kyle T 0 Reputation points
2023-12-25T09:28:16.9333333+00:00

Hello all,

I'm very new to the Microsoft Graph API, however, I am developing a calendar "booking" system (in NodeJS) that creates events in a shared calendar using the Microsoft Graph API. When I create the events, I include around 9 singleValueExtendedProperties. Previously I was inputting these values in the body but it made it difficult to parse them later on when/if needed as it's saved as html.

I have an event update form and function which I am trying to implement. Basically, I am (trying) to grab an event based on a single value extended property I set, and then take all of the rest of the properties associated with the event and save them as variables in my code (which I then prefill in a form).

I'm having two issues:

  1. When I use the API without filters
const events = await client.api(`/users/${sharedMailbox}/calendars/${calendarId}/events`)

                                   .select('id,subject,body,singleValueExtendedProperties')

                                   .expand('singleValueExtendedProperties')

                                   .get();

I don't get any matching results - is it not possible to not specify a filter so it uses all singleValueExtendedProperties?

  1. When I do specify a filter and get a response/match, the json response I get doesn't include singleValueExtendedProperties in it anywhere. It includes everything else except it.

How can I get all of an event's singleValueExtendedProperties in a response from a Graph API call? If also possible, I'd prefer to even be able to get all events, and in the response for all of the events, include all singleValueExtendedProperties for each.

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

1 answer

Sort by: Most helpful
  1. CarlZhao-MSFT 46,346 Reputation points
    2023-12-26T09:24:14.97+00:00

    Hi @Kyle T

    You need to specify the id/value of the extended properties in the request and use the filter query parameter to filter. Refer to Get singleValueLegacyExtendedProperty API.

    Code example:

    const options = {
    	authProvider,
    };
    
    const client = Client.init(options);
    
    let event = await client.api('/users/{userId}/calendars/{calendarId}/events/{eventId}')
    	.expand('singleValueExtendedProperties($filter=id eq \'String {66f5a359-4659-4830-9070-00047ec6ac6e} Name Color\')')
    	.get();
    

    Hope this helps.

    If the reply is helpful, please click Accept Answer and kindly upvote it. If you have additional questions about this answer, please click Comment.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.