web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archive)
Answered

Query calendar rules

(0) ShareShare
ReportReport
Posted on by 180

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
    180 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 Spotlight of the Month

Kudos to Mohamed Amine Mahmoudi!

Blog subscriptions now enabled!

Follow your favorite blogs

TechTalk: How Dataverse and Microsoft Fabric powers ...

Explore the latest advancements in data export and integration within ...

Leaderboard > 🔒Ι Microsoft Dynamics CRM (Archived)

Featured topics

Product updates

Dynamics 365 release plans