cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
1TF0rward
Frequent Visitor

Room Display Help

Hi,

 

I need some help with some thing in my app. Please see attached Image for reference.

 

First Problem: I want to have a room status, so where it says "Available" I need it to hide and then an "Occupied" show when an event is running. I have tried this though both Office 365 and Google Calendar but can't seem to get it to work. I have tried "Office365Outlook.OnUpcomingEvents" and "GoogleCalendar.OnEventStart". I seem to have hit a brick wall.

 

Second Problem: I want to 3 event shown as in attachment. 1st event to be the previous event, middle event to be the current event (Or free) and the last to be the upcoming event. I will also want the 1st and 3rd to be greyed out and change to the next event etc.

 

Any help would be highly appreciated!

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @1TF0rward 

If you set the code into OnVisible property, it is not easy to trigger it.  Please try the code in OnSelect of button.

If the collection is still empty , you can increase the date interval to check if the formula works.

 

Set(MyCalID,LookUp(Office365Outlook.CalendarGetTables().value,DisplayName="Calendar").Name) ;
ClearCollect( MYCOl, Office365Outlook.GetEventsCalendarViewV3(MyCalID,Text(Now(),UTC),Text(DateAdd(Now(),1,Day),UTC)).value)

 

I also suggest you can try it in a new app.

Best regards,

Sik

View solution in original post

11 REPLIES 11
v-siky-msft
Community Support
Community Support

Hi @1TF0rward ,

 

Get the calendar event view based on current date time to collection, if the collection is empty, that means the room is available, if not empty, that means a event is running.

Set the following codes to OnVisible property of screen:

Set(StartDateTimeUTC, DateAdd(Now(), TimeZoneOffset(), Minutes) );
Set(EndDateTimeUTC, DateAdd(Now(), TimeZoneOffset()+1, Minutes));
ClearCollect( MyCollection, Office365Outlook.GetEventsCalendarViewV3(CalendarID,StartDateTimeUTC,EndDateTimeUTC).value)

Set the following codes to Text of Label:

If(IsEmpty(MyCollection),"avilable", "unavilable")

 

Best regards,

Sik

Thank you for your help! @v-siky-msft 

 

I am getting this error though?

Office365Outlook.GetEventsCalendarViewV2 failed: { "status": 400, "message": "Invalid value '17/12/2019 11:57' for parameter 'Start Time'.\r\nclientRequestId: 6448b996-010e-44c6-ac56-179a917bb55f", "error": { "message": "Invalid value '17/12/2019 11:57' for parameter 'Start Time'." }, "source": "office365-ne.azconn-ne-01.p.azurewebsites.net" }

 

I think I am also struggling with the calendarID I have put the name like this "Meeting Room" is that correct or is there another way of getting the ID and putting it in?

 

Regards,
Liam

Hi @1TF0rward ,

 

Please change to use GetEventsCalendarViewV3 action, not GetEventsCalendarViewV2 (DEPRECATED)

You can use CalendarGetTables_V2 action to get the Calendar ID. For example, put Office365Outlook.CalendarGetTables().value to Items property of Combo box, select Calendar, then use ComboBox1.Selected.Name to get the Calendar ID.

Snipaste_2019-12-18_09-59-19.png

 

Best regards,

Sik

Hi,

 

It is just saying Available no matter what calendar ID I put in.

 

Regards,

Liam

The Calendar should choose "Calendar". Could you share the MyCollection? The available means there is no event running currently.

Please check if there are any events in the collection that are currently running.

Sik

Hi,

 

there is nothing in MyCollection.

I am getting this error if I publish and play.

"Office365Outlook.GetEventsCalendarViewV3 failed: { "status": 400, "message": "Invalid value '18/12/2019 10:32' for parameter 'Start Time'.\r\nclientRequestId: f984f6ca-faeb-4a1f-8d7c-e5a504e125e0", "error": { "message": "Invalid value '18/12/2019 10:32' for parameter 'Start Time'." }, "source": "office365-ne.azconn-ne-01.p.azurewebsites.net" }"


Regards,

Liam

I am test from my side, and this formula work fine.

1. ensure you have added Office365 Outlook connection

2. add a current event in the Outlook Calendar 

3. Put this code to OnVisible property of screen

Set(MyCalID,LookUp(Office365Outlook.CalendarGetTables().value,DisplayName="Calendar").Name) ;
ClearCollect( MYCOl, Office365Outlook.GetEventsCalendarViewV3(MyCalID,Text(Now(),UTC),Text(DateAdd(Now(),1,Minutes),UTC)).value)

4. Set Text of label:

If(IsEmpty(MyCol),"avilable", "unavilable")

 Snipaste_2019-12-19_10-28-58.pngSnipaste_2019-12-19_10-29-32.png

Best regards,
Sik

This is so odd! Please see the screenshots of the steps. As you can see the actual meetings are showing but text not changing and nothing in my collection. (Ignore spellings!)

powerapps.PNGpowerapps available.PNGMYCOL.PNGCalendar.PNG

 

Regards,

Liam

Hi @1TF0rward 

If you set the code into OnVisible property, it is not easy to trigger it.  Please try the code in OnSelect of button.

If the collection is still empty , you can increase the date interval to check if the formula works.

 

Set(MyCalID,LookUp(Office365Outlook.CalendarGetTables().value,DisplayName="Calendar").Name) ;
ClearCollect( MYCOl, Office365Outlook.GetEventsCalendarViewV3(MyCalID,Text(Now(),UTC),Text(DateAdd(Now(),1,Day),UTC)).value)

 

I also suggest you can try it in a new app.

Best regards,

Sik

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on June 15, 2022 at 8am PDT.

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Top Kudoed Authors
Users online (1,878)