cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper II
Helper II

Calendar is emtpy at start

Hi all,

 

I´m currently building a custom calendar from the "Calendar" Template. It is available under Home->New Screen.

However I´m currently having the problem, that when I open up the app, I´m always getting the view from Picture 1.

I always need to choose the "Calendar" in the dropdown. After that it looks like it supposed to be. I want to hide the dropdown, unfortunately I can´t because of the blank view.

 

How can I resolve that problems? Any ideas?

 

BR

 

Picture 1

errorpa.png

Picture 2

errorpa2.png

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User
Super User

Re: Calendar is emtpy at start

Hi @Belasor 

 

Its actually the OnSelect action of the dropdown that is setting and collecting the date events - this is why its not there by default.

 

On your Screen's OnVisible, you can put that same OnSelect code and replace the Self.Selected with YourDropdownName.Selected  (see below) - then you can hide the dropdown for this. However those with more than one calendar will no longer be able to change their calendar...

 

/*retrieves calendar events for all days in current month view and selected calendar 
_minDate and _maxDate act as markers to prevent duplicate data collection*/         
If(IsBlank(_userDomain),         
	UpdateContext({_showLoading: true});         
	Set(_userDomain, Right(User().Email, Len(User().Email) - Find("@", User().Email)));         
	Set(_dateSelected, Today());         
	Set(_firstDayOfMonth, DateAdd(Today(), 1 - Day(Today()), Days));         
	Set(_firstDayInView, DateAdd(_firstDayOfMonth, -(Weekday(_firstDayOfMonth) - 2 + 1), Days));         
	Set(_lastDayOfMonth, DateAdd(DateAdd(_firstDayOfMonth, 1, Months), -1, Days))         
);         
Set(_calendarVisible, false);         
UpdateContext({_showLoading: true});         
Set(_myCalendar, dropdownCalendarSelection1.Selected);         
Set(_minDate, DateAdd(_firstDayOfMonth, -(Weekday(_firstDayOfMonth) - 2 + 1), Days));         
Set(_maxDate, DateAdd(DateAdd(_firstDayOfMonth, -(Weekday(_firstDayOfMonth) - 2 + 1), Days), 40, Days));         
ClearCollect(MyCalendarEvents, Microsoft365Outlook.GetEventsCalendarViewV2(_myCalendar.Name, Text(_minDate, UTC), Text(_maxDate, UTC)).value);         
UpdateContext({_showLoading: false});         
Set(_calendarVisible, true)

 

Cheers,

Sancho

 

@iAm_ManCat

Please 'Mark as Solution' if someone's post answered your question and always 'Thumbs Up' the posts you like or that helped you!


Thanks!
You and everyone else in the community make it the awesome and welcoming place it is, keep your questions coming and make sure to 'like' anything that makes you 'Appy
Sancho Harker, MVP


View solution in original post

6 REPLIES 6
Highlighted
Super User
Super User

Re: Calendar is emtpy at start

Hi @Belasor 

 

Its actually the OnSelect action of the dropdown that is setting and collecting the date events - this is why its not there by default.

 

On your Screen's OnVisible, you can put that same OnSelect code and replace the Self.Selected with YourDropdownName.Selected  (see below) - then you can hide the dropdown for this. However those with more than one calendar will no longer be able to change their calendar...

 

/*retrieves calendar events for all days in current month view and selected calendar 
_minDate and _maxDate act as markers to prevent duplicate data collection*/         
If(IsBlank(_userDomain),         
	UpdateContext({_showLoading: true});         
	Set(_userDomain, Right(User().Email, Len(User().Email) - Find("@", User().Email)));         
	Set(_dateSelected, Today());         
	Set(_firstDayOfMonth, DateAdd(Today(), 1 - Day(Today()), Days));         
	Set(_firstDayInView, DateAdd(_firstDayOfMonth, -(Weekday(_firstDayOfMonth) - 2 + 1), Days));         
	Set(_lastDayOfMonth, DateAdd(DateAdd(_firstDayOfMonth, 1, Months), -1, Days))         
);         
Set(_calendarVisible, false);         
UpdateContext({_showLoading: true});         
Set(_myCalendar, dropdownCalendarSelection1.Selected);         
Set(_minDate, DateAdd(_firstDayOfMonth, -(Weekday(_firstDayOfMonth) - 2 + 1), Days));         
Set(_maxDate, DateAdd(DateAdd(_firstDayOfMonth, -(Weekday(_firstDayOfMonth) - 2 + 1), Days), 40, Days));         
ClearCollect(MyCalendarEvents, Microsoft365Outlook.GetEventsCalendarViewV2(_myCalendar.Name, Text(_minDate, UTC), Text(_maxDate, UTC)).value);         
UpdateContext({_showLoading: false});         
Set(_calendarVisible, true)

 

Cheers,

Sancho

 

@iAm_ManCat

Please 'Mark as Solution' if someone's post answered your question and always 'Thumbs Up' the posts you like or that helped you!


Thanks!
You and everyone else in the community make it the awesome and welcoming place it is, keep your questions coming and make sure to 'like' anything that makes you 'Appy
Sancho Harker, MVP


View solution in original post

Highlighted
Helper II
Helper II

Re: Calendar is emtpy at start

Thank you very much, that is the solution.

Highlighted
Super User
Super User

Re: Calendar is emtpy at start

Excellent, glad I could help - hope you have a great day!

 

@iAm_ManCat

Please 'Mark as Solution' if someone's post answered your question and always 'Thumbs Up' the posts you like or that helped you!


Thanks!
You and everyone else in the community make it the awesome and welcoming place it is, keep your questions coming and make sure to 'like' anything that makes you 'Appy
Sancho Harker, MVP


Highlighted
Helper II
Helper II

Re: Calendar is emtpy at start

Hello,

 

I have a small question, I just got today the information that currently there is a error coming up every time when using the PowerApp:

Office365Outlook.GetEventsCalendarViewV2 failed: The method 'GetEventsCalendarViewV2' has an invalid value for parameter 'calendarId'

 

OnVisible Code:

/*retrieves calendar events for all days in current month view and selected calendar 
_minDate and _maxDate act as markers to prevent duplicate data collection*/         
If(IsBlank(_userDomain);         
	UpdateContext({_showLoading: true});;         
	Set(_userDomain; Right(User().Email; Len(User().Email) - Find("@"; User().Email)));;         
	Set(_dateSelected; Today());;         
	Set(_firstDayOfMonth; DateAdd(Today(); 1 - Day(Today()); Days));;         
	Set(_firstDayInView; DateAdd(_firstDayOfMonth; -(Weekday(_firstDayOfMonth) - 2 + 1); Days));;         
	Set(_lastDayOfMonth; DateAdd(DateAdd(_firstDayOfMonth; 1; Months); -1; Days))         
);;         
Set(_calendarVisible; false);;         
UpdateContext({_showLoading: true});;         
Set(_myCalendar; dropdownCalendarSelection2_2.Selected);;         
Set(_minDate; DateAdd(_firstDayOfMonth; -(Weekday(_firstDayOfMonth) - 2 + 1); Days));;         
Set(_maxDate; DateAdd(DateAdd(_firstDayOfMonth; -(Weekday(_firstDayOfMonth) - 2 + 1); Days); 40; Days));;         
ClearCollect(MyCalendarEvents; Office365Outlook.GetEventsCalendarViewV2(_myCalendar.Name; Text(_minDate; UTC); Text(_maxDate; UTC)).value);;         
UpdateContext({_showLoading: false});;         
Set(_calendarVisible; true)

 OnSelect code:

/*retrieves calendar events for all days in current month view and selected calendar 
_minDate and _maxDate act as markers to prevent duplicate data collection*/         
If(IsBlank(_userDomain);         
	UpdateContext({_showLoading: true});;         
	Set(_userDomain; Right(User().Email; Len(User().Email) - Find("@"; User().Email)));;         
	Set(_dateSelected; Today());;         
	Set(_firstDayOfMonth; DateAdd(Today(); 1 - Day(Today()); Days));;         
	Set(_firstDayInView; DateAdd(_firstDayOfMonth; -(Weekday(_firstDayOfMonth) - 2 + 1); Days));;         
	Set(_lastDayOfMonth; DateAdd(DateAdd(_firstDayOfMonth; 1; Months); -1; Days))         
);;         
Set(_calendarVisible; false);;         
UpdateContext({_showLoading: true});;         
Set(_myCalendar; dropdownCalendarSelection2_2.Selected);;         
Set(_minDate; DateAdd(_firstDayOfMonth; -(Weekday(_firstDayOfMonth) - 2 + 1); Days));;         
Set(_maxDate; DateAdd(DateAdd(_firstDayOfMonth; -(Weekday(_firstDayOfMonth) - 2 + 1); Days); 40; Days));;         
ClearCollect(MyCalendarEvents; Office365Outlook.GetEventsCalendarViewV2(_myCalendar.Name; Text(_minDate; UTC); Text(_maxDate; UTC)).value);;         
UpdateContext({_showLoading: false});;         
Set(_calendarVisible; true)

 Did I made some mistakes?

Highlighted
Super User
Super User

Re: Calendar is emtpy at start

Hello! It's maybe worth testing that the dropdown is actually visible and filled when that screen's onVisible loads, otherwise it won't be able to set the _mycalendar variable.

 

If you have enabled some of the preview features like delayed load etc then the dropdown may not have been created prior to the screen being visible for the first time - What I would look at doing is creating a hidden label on your App's First screen - have the label point to 

dropdownCalendarSelection2_2.Selected

 

So that the dropdown is loaded before the screen becomes visible.

 

Otherwise you could also look at testing with some users by making the dropdown visible for them and seeing if they can choose manually from the dropdown and if they still get the same error

 

Hopefully that helps! 


@iAm_ManCat

Please 'Mark as Solution' if someone's post answered your question and always 'Thumbs Up' the posts you like or that helped you!


Thanks!
You and everyone else in the community make it the awesome and welcoming place it is, keep your questions coming and make sure to 'like' anything that makes you 'Appy
Sancho Harker, MVP


Highlighted
Helper II
Helper II

Re: Calendar is emtpy at start

Thank you sir, problem solved again :). Working now.

Helpful resources

Announcements
August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Super Users Coming in August

We are excited for the next Super User season.

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (8,057)