Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Answered

Query calendar rules

(0) ShareShare
ReportReport
Posted on by 2

Need to know if: given a time T0, T0 is a valid Operating Hour (our users are at work) or not (holiday, time off, break) based on a Calendar queue and its related calendar rules.

Is there a way to query odata the calendar rules?

Based on this article

   

I tried to query odata as:

https://[...]/api/data/v9.2/calendars(07d4aaa7-9453-ed11-bba2-000d3adf73bc)$expand=calendar_calendar_rules

but it results in bad request

{"error":{"code":"0x8006088a","message":"Bad Request - Error in query syntax."}}

In particular I need to figure out if there's a way to now if my Queue users are online (working) /offline (break,holidays,service is closed) within a Power Automate]
  • Iuliia Sh. Profile Picture
    15 on at
    RE: Query calendar rules

    Hi,

    Thanks a lot for sharing, it actually works and returns a list of time slots.

    Anyway, did you have a chance to get deeper into this HTTP request?

    https://[organisation].crm3.dynamics.com/api/data/v9.1/calendars([GUID])?$expand=calendar_calendar_rules

    It works well for me and returns a lot of useful properties according to the spec:

    learn.microsoft.com/.../calendarrule

    The only issue is the wrong value of "starttime" response parameter. This parameter has a DateTime structure but always returns zeroes in a TIME part.

    Like this: "starttime": "2022-11-14T00:00:00Z".

    I got these zero-time values for any rule in responses when all the rules have different start times in CRM UI.

    Have you ever succeeded in requesting expand=calendar_calendar_rules? And have you ever faced this issue?

    I would appreciate it a lot if you could check that -)

  • Suggested answer
    ___Pool___ Profile Picture
    2 on at
    RE: Query calendar rules

    For those of you looking at the same information, rhis is what I was looking for, and it works:

    https://[...].crm4.dynamics.com/api/data/v9.0/calendars([yourcalendarid])/Microsoft.Dynamics.CRM.ExpandCalendar(Start=@d1,End=@d2)?@d1=2022-11-03T00:00:00.000Z&@d2=2022-11-03T23:59:59.999Z

    it returns the list of availability and breaks for a given time range [d1,d2].

    Substitute [yourcalendarid] 

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Kudos to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Daivat Vartak (v-9davar) Profile Picture

Daivat Vartak (v-9d... 225 Super User 2025 Season 1

#2
Muhammad Shahzad Shafique Profile Picture

Muhammad Shahzad Sh... 97

#3
Vahid Ghafarpour Profile Picture

Vahid Ghafarpour 82 Super User 2025 Season 1

Overall leaderboard

Product updates

Dynamics 365 release plans