How to get EndRecurrenceDate using microsoft graph api - microsoft-graph-api

I am trying to get EndRecurrenceDate using ms graph api by referring this documents .link 1
none of followings didn't work for me . what could be the reasons
https://graph.microsoft.com/v1.0/me/events/{event-id}==?$expand=singleValueExtendedProperties($filter=id eq 'String {6ED8DA90-450B-101B-98DA-00AA003F1305} Id 0x0000000F')
.
I chnaged expand query but it also does not give any value for singleValueExtendedProperties in API response
$expand=singleValueExtendedProperties($filter=id eq 'Date {6ED8DA90-450B-101B-98DA-00AA003F1305} Id 0x0000000F')
$expand=singleValueExtendedProperties($filter=id eq 'String {6ED8DA90-450B-101B-98DA-00AA003F1305} Id 0x0000000F')
$expand=singleValueExtendedProperties($filter=id eq 'String {6ED8DA90-450B-101B-98DA-00AA003F1305} Name PidLidEndRecurrenceTime')

In MS-Graph API, please retrieve the seriesMaster by passing the seriesMasterId corresponding to the given event:
https://learn.microsoft.com/en-us/graph/api/resources/event?view=graph-rest-1.0
For verification, please check the field "type" which specifies the event type. It should have value "seriesMaster".
In the seriesMaster that has been retrieved, the field "end" will represent the end date of the recurrence.

Related

Expanded SingleValueExtendedProperties do not show up when combined with $select

I'm currently using Microsoft Graph to retrieve appointments from a users calendar. I need to access the singleValueExtendedProperties and only a few properties of the appointment.
Accessing this url
https://graph.microsoft.com/v1.0/users/XXXXXX/calendarView?startDateTime=2023-05-01T12:00:00&endDateTime=2023-05-30T12:00:00&$expand=singleValueExtendedProperties($filter=id eq 'String {GUID1} Name Creator' or id eq 'String {GUID2} Name Type')&$top=50
returns the entire appointments with it's singleValueExtendeProperties.
However, when I combine that with a select like so
https://graph.microsoft.com/v1.0/users/XXXXXX/calendarView?startDateTime=2023-05-01T12:00:00&endDateTime=2023-05-30T12:00:00&$expand=singleValueExtendedProperties($filter=id eq 'String {GUID1} Name Creator' or id eq 'String {GUID2} Name Type')&$select=id,start,end,isAllDay,showAs,categories,subject,sensitivity,singleValueExtendedProperties&$top=50
I only get the selected fields without the singleValueExtendedProperties.
Am I doing something wrong?
This is a known issue/bug with the Graph Microsoft Graph -> Use the singleValueExtendedProperty in OData $select when expanded $expand one way of working around it is to include the extendedproperty you want returned in a filter clause, even though you may not want to filter items you can make your filter generic so it just returns all item with that property eg this is an example just using the extended property for subject (note your shouldn't have
https://graph.microsoft.com/v1.0/me/calendar/calendarView?startDateTime=2022-09-01T19:00:00Z&endDateTime=2022-09-10T19:00:00Z&$select=Subject,Start,End,singleValueExtendedProperties&$expand=singleValueExtendedProperties($filter=id eq 'String 0x0037')&$filter=singleValueExtendedProperties/any(ep: ep/id eq 'String 0x0037' and ep/value ne null)
IMO Microsoft should just fix this on the backend.

How to incorporate the usage of AND when querying onPremisesExtensionAttributes/extensionAttribute in the MS Graph API?

I'm currently trying to query multiple values when it comes to onPremisesExtensionAttributes/extensionAttribute in MS Graph API.
I'm able to query this one:
https://graph.microsoft.com/beta/users?$count=true&$filter=onPremisesExtensionAttributes/extensionAttribute1 eq 'attr1'
But I want to query more values than attr1, but I haven't managed to get it to work.
I've tried queries, such as these two:
https://graph.microsoft.com/beta/users?$count=true&$filter=onPremisesExtensionAttributes/extensionAttribute1 eq 'attr1' and 'attr2' and 'attr3'
https://graph.microsoft.com/beta/users?$count=true&$filter=onPremisesExtensionAttributes/extensionAttribute13 eq 'attr1'&$onPremisesExtensionAttributes/extensionAttribute1 eq 'attr2'&$onPremisesExtensionAttributes/extensionAttribute1 eq 'attr3'
the correct syntax should be
$filter=onPremisesExtensionAttributes/extensionAttribute13 eq 'attr1' and onPremisesExtensionAttributes/extensionAttribute13 eq 'attr2' and onPremisesExtensionAttributes/extensionAttribute13 eq 'attr3'
one filter param to include all conditions, and each condition is full - field eq 'value'

Filter by Date then Aggregate value isn't working OData

I'm trying to retrieve some data with OData, but when I send this Query : $filter=(General eq '401000' and date(DateComptable) ge 2022-06-01T00:00:00Z and date(DateComptable) le 2022-06-30T00:00:00Z)&$apply=groupby((General),aggregate(Debit with sum as TotalDebit, Credit with sum as TotalCredit)) I'm gettng this error :
Property or path DateComptable isn't available in the current context.
It was removed in earlier transformation.
Any idea on how to solve that problem?
The problem here was that the groupby ALWAYS happens before the filter, so I needed to use $apply=filter(General eq '401000' and date(DateComptable) ge 2022-06-01T00:00:00Z and date(DateComptable) le 2022-06-30T00:00:00Z)/groupby((General),aggregate(Debit with sum as TotalDebit, Credit with sum as TotalCredit)).
Doing so, the filter is trigger before the groupby and it works smoothly

Filter SharePoint library items by lookup column using Graph API

I have a SharePoint list and a document library. Each document is linked to an item in my list using a custom field CustomRecordLookupId
If I select all documents and use $expand=listitem, I can see the CustomRecordLookupId values in the results.
I am unable to use this lookup column to query, however.
https://graph.microsoft.com/v1.0/drives/{drive_id}/root/children?$expand=listitem&$filter=listitem/fields/CustomRecordLookupId eq 1
The error is: Operation not supported
Per my test, I got the same result as yours. This is not supported for drive item, you should do the filter for listitems:
https://graph.microsoft.com/v1.0/sites/{site_id}/lists/{list_id}/items?$expand=fields&$filter=fields/CustomRecordLookupId eq 1

OData filter options (handle null or empty values)

We are using $filter system query option in OData to execute filters where the filter value is sent in at runtime.
As an example the OData URL would be like this:
http://services.odata.org/Northwind/Northwind.svc/Customers?$filter=CustomerID eq #InCustomerID and Country eq #InCountry
where #InCustomerID & #InCountry are the input values for the equal filter.
At run time when the user enters some value for Customer ID (say 'ABCD') we would replace the #InCustomerID by 'ABCD'
At runtime the query would be as follows:
http://services.odata.org/Northwind/Northwind.svc/Customers?$filter=CustomerID eq 'ABCD' and Country eq 'US'
In the above case the user has entered the following values: CustomerID => 'ABCD' and Country => 'US'
My question is regarding handling of null values in OData $filter. If the user does not enter any value for CustomerID then we want to select all customers from specific country.
In sql case this would be something like:
select * from Customers where ((CustomerID = #InCustomerID) or (#CustomerID is null)) and (Country = #Country).
Essentially how to handle null or empty values so that the specific predicate in the logical condition would always be true.
Does OData filtering enables this option?
You can compare to null using the equality operator like this:
$filter=CustomerID eq null
In your case the query would degenerate to something like:
$filter=(CustomerID eq null) or (null eq null)
Which should work, but it's not very nice.
Did you consider removing the predicate completely in such case?

Resources