cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
mhage
Level: Powered On

PowerApps Book a Room Unable to fetch existing meetings

This solution is exactly what my organization needs and would like to get it going in full swing, but I am experiencing one last issue...

 

When i try to use the 'Book for an existing meeting' , where the current logged in user's calendar is retreived from O365, It fails with an error 'Office365.GetEventsCalendarViewV2 Failed:  The method 'GetEventsCalendarviewV2' has an invalid value for parameter 'calendarid'

 

error2.png

 

...and within the powerapp itself when i select the 'MeetingSelectScreen' area i also notice an BadGateway error:

 

error.png

 

I have verified the status of DataSources Office365Users, Office365 & SkypeForBusiness to be connected and signed in.  I have removed the DataSources and re-created them from scratch.

 

I verified that the language of our tenant, including the current settings, is set to English-US and that the onStartup Code expression is using the correct calling method 'Calendar':

Set(MyCalendar, LookUp(Office365.CalendarGetTables().value, DisplayName = "Calendar").Name);

Your assistance is greatly appreciated!

 

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: PowerApps Book a Room Unable to fetch existing meetings

Hi mhage,

 

This isn't a solution, and I don't seem to get your first page error, but I do get the bad gateway error.  I haven't checked the rest of the apps functionality to see if it's affected elsewhere, but the issue seems to be the filter on the second page Onvisible property;

 

    ClearCollect(FutureCalendarEvents, Office365.GetEventsCalendarViewV2(MyCalendar, Text(DateAdd(DateSelected, -1, Hours), UTC), 
    Text(DateAdd(DateSelected, 1, Days), UTC), {'$filter': "Organizer/EmailAddress/Name eq '" & MyName & "'"}).value);

I'm not very familiar with Odata query syntax, and I've never seen it constructed like that - perhaps the template builder or someone who's familiar with it can provide more info.

 

The intent of the call seems to be to filter calendar events that haven't happened today yet by the user as the organizer.

This sort of makes sense as to book a room you need to invite it, so you would probably need to be the organizer?  (Not sure if forwarding the meeting request to the room would work, but it's possible I guess).

 

To prove the point - you can achieve the same result by taking out the filter on the query and instead just returning all your future meetings for today - you can then filter the resulting collection by meetings where you're the organizer.  A little inefficient, but it seems to provide the intended result.

 

To test this, first Update the ClearCollect statement on the second screen OnVisible action to remove the filter command.
Leave the rest of the statements as they are, just edit the ClearCollect function.

The ClearCollect should then look like this;

 

    ClearCollect(FutureCalendarEvents, Office365.GetEventsCalendarViewV2(MyCalendar, Text(DateAdd(DateSelected, -1, Hours), UTC), 
    Text(DateAdd(DateSelected, 1, Days), UTC)).value);

Then select the MeetingsGallery gallery and edit it's Items from this; 

Sort(Filter(FutureCalendarEvents, Start >= DateAdd(Now(), -2, Hours) && End >= Now(), Day(Start) = Day(DateSelected)), Start, Ascending)

To this; 

Sort(Filter(FutureCalendarEvents, Start >= DateAdd(Now(), -2, Hours) && End >= Now(), Day(Start) = Day(DateSelected) && Organizer=User().Email), Start, Ascending)

 

 If it works for you as it did for me then it seems to point to the filter function as the culprit.  

I would caution against just using this as a workaround as I haven't looked into the rest of the app to see whether this change might impact anything else - there's a reason it was built like this in the first place, so working around it may introduce unintended behaviour elsewhere.

 

Anyway, hope this helps

 

Kind regards 

 

RT

6 REPLIES 6
Super User
Super User

Re: PowerApps Book a Room Unable to fetch existing meetings

Hi mhage,

 

This isn't a solution, and I don't seem to get your first page error, but I do get the bad gateway error.  I haven't checked the rest of the apps functionality to see if it's affected elsewhere, but the issue seems to be the filter on the second page Onvisible property;

 

    ClearCollect(FutureCalendarEvents, Office365.GetEventsCalendarViewV2(MyCalendar, Text(DateAdd(DateSelected, -1, Hours), UTC), 
    Text(DateAdd(DateSelected, 1, Days), UTC), {'$filter': "Organizer/EmailAddress/Name eq '" & MyName & "'"}).value);

I'm not very familiar with Odata query syntax, and I've never seen it constructed like that - perhaps the template builder or someone who's familiar with it can provide more info.

 

The intent of the call seems to be to filter calendar events that haven't happened today yet by the user as the organizer.

This sort of makes sense as to book a room you need to invite it, so you would probably need to be the organizer?  (Not sure if forwarding the meeting request to the room would work, but it's possible I guess).

 

To prove the point - you can achieve the same result by taking out the filter on the query and instead just returning all your future meetings for today - you can then filter the resulting collection by meetings where you're the organizer.  A little inefficient, but it seems to provide the intended result.

 

To test this, first Update the ClearCollect statement on the second screen OnVisible action to remove the filter command.
Leave the rest of the statements as they are, just edit the ClearCollect function.

The ClearCollect should then look like this;

 

    ClearCollect(FutureCalendarEvents, Office365.GetEventsCalendarViewV2(MyCalendar, Text(DateAdd(DateSelected, -1, Hours), UTC), 
    Text(DateAdd(DateSelected, 1, Days), UTC)).value);

Then select the MeetingsGallery gallery and edit it's Items from this; 

Sort(Filter(FutureCalendarEvents, Start >= DateAdd(Now(), -2, Hours) && End >= Now(), Day(Start) = Day(DateSelected)), Start, Ascending)

To this; 

Sort(Filter(FutureCalendarEvents, Start >= DateAdd(Now(), -2, Hours) && End >= Now(), Day(Start) = Day(DateSelected) && Organizer=User().Email), Start, Ascending)

 

 If it works for you as it did for me then it seems to point to the filter function as the culprit.  

I would caution against just using this as a workaround as I haven't looked into the rest of the app to see whether this change might impact anything else - there's a reason it was built like this in the first place, so working around it may introduce unintended behaviour elsewhere.

 

Anyway, hope this helps

 

Kind regards 

 

RT

mhage
Level: Powered On

Re: PowerApps Book a Room Unable to fetch existing meetings

Russel, you rock!  I can confirm that removing the filter does infact solve my issue.

I heed your caution, and will explore all other relevant areas of the app to see what functions might be affected by this change and revert back to this post if i find anything.

 

Thank you very much for your prompt response and detailed instructions!

Eisenwulf
Level: Power Up

Re: PowerApps Book a Room Unable to fetch existing meetings

Hi RT,

 

Your previous solution worked but now the problem is that, when I click on an existing meeting without a room, it shows the next page to select a room but there are no rooms appearing. This is still a test setup and there should be rooms available. It is not showing those rooms.

 

Am I missing something?

 

Thanks in advance.

 

Regards,

VY

anjcerbolles
Level: Powered On

Re: PowerApps Book a Room Unable to fetch existing meetings

Hi Eisenwulf,

 

What I did and it's working fine was, I just removed the one below in OnVisible property in MeetingSelectScreen.

{'$filter': "Organizer/EmailAddress/Name eq '" & MyName & "'"}

 

Hope this helps as well.

 

Best Regards,

Anj Smiley Happy 

Xanthine
Level: Powered On

Re: PowerApps Book a Room Unable to fetch existing meetings

Thank you this worked for me too!

Eisenwulf
Level: Power Up

Re: PowerApps Book a Room Unable to fetch existing meetings

Sorry for the long response. I'm not sure if I am seeing it right. Upon checking my code, there's no line like that:

If(
DateTimeRoomChange,
UpdateContext({ShowLoading: true});
Set(
DateTimeRoomChange,
false
);
ClearCollect(
FutureCalendarEvents,
Office365.GetEventsCalendarViewV2(
MyCalendar,
Text(
DateAdd(
DateSelected,
-1,
Hours
),
UTC
),
Text(
DateAdd(
DateSelected,
1,
Days
),
UTC
)
).value
);
UpdateContext({ShowLoading: false})
);
Set(
CalendarFromSelectMeeting,
false
)

Helpful resources

Announcements
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

SecondImage

PowerApps Monthly Community Call

Next Wednesday, August 21st at 8am PDT

Top Community Contributors for July 2019

Top Community Contributors for July 2019

Let's thank our top community contributors

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

FifthImage

Dynamics 365 and Power Platform April 2019 Release notes

Features releasing from April 2019 through September 2019!

SixthImage

Power Summit Australia 2019

August 20-23rd 2019

Users Online
Currently online: 67 members 4,709 guests
Please welcome our newest community members: