Skip to main content

Notifications

Power Apps - Building Power Apps
Unanswered

Add only one calendar from Outlook to PowerApps

Posted on by 10

Hey, I am trying to figure out a way to add only one specific calendar from outlook instead of all my calendars but can't figure it out. I am using the calendar template screen that is already on PowerApps. Not sure if there is a specific formula I must input or where to input it. 

  • michalparal222 Profile Picture
    michalparal222 86 on at
    Re: Add only one calendar from Outlook to PowerApps

    Hi  ,

    you can use Power Automate to achieve this goal. I am not sure about your Power Apps experience so I created this step by step instructions.

     

    First create a Power automate Flow.

    michalparal222_0-1720682980300.png

    Set the Run only users connection to "Use this connection"

     

    michalparal222_1-1720683008999.png

    Add the flow in app 

    michalparal222_2-1720683030184.png

     

    Paste this code in the onVisible property of your Screen

    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()), TimeUnit.Days)); 
    	Set(_firstDayInView, DateAdd(_firstDayOfMonth, -(Weekday(_firstDayOfMonth) - 2 + 1), TimeUnit.Days)); 
    	Set(_lastDayOfMonth, DateAdd(DateAdd(_firstDayOfMonth, 1, TimeUnit.Months), -1, TimeUnit.Days)) 
    ); 
    Set(_calendarVisible, false); 
    UpdateContext({_showLoading: true}); 
    Set(_minDate, DateAdd(_firstDayOfMonth, -(Weekday(_firstDayOfMonth) - 2 + 1), TimeUnit.Days)); 
    Set(_maxDate, DateAdd(DateAdd(_firstDayOfMonth, -(Weekday(_firstDayOfMonth) - 2 + 1), TimeUnit.Days), 40, TimeUnit.Days)); 
    UpdateContext({_showLoading: false}); 
    Set(_calendarVisible, true);
    Set(varCalendarItems, test0008.Run(Text(_minDate, DateTimeFormat.UTC),Text(_maxDate, DateTimeFormat.UTC)).response); // Replace the test0008 with your Flow name
    Set(parsedItems, ParseJSON(varCalendarItems));
    
    // Create a collection from the parsed items
    ClearCollect(
     myCollection,
     ForAll(
     parsedItems,
     {
     Subject: Text(ThisRecord.subject),
     Start: DateTimeValue(ThisRecord.start),
     End: DateTimeValue(ThisRecord.end),
     StartWithTimeZone: Text(ThisRecord.startWithTimeZone),
     EndWithTimeZone: Text(ThisRecord.endWithTimeZone),
     Body: Text(ThisRecord.body),
     IsHtml: Boolean(ThisRecord.isHtml),
     ResponseType: Text(ThisRecord.responseType),
     ResponseTime: DateTimeValue(ThisRecord.responseTime),
     Id: Text(ThisRecord.id),
     CreatedDateTime: DateTimeValue(ThisRecord.createdDateTime),
     LastModifiedDateTime: DateTimeValue(ThisRecord.lastModifiedDateTime),
     Organizer: Text(ThisRecord.organizer),
     TimeZone: Text(ThisRecord.timeZone),
     ICalUId: Text(ThisRecord.iCalUId),
     Categories: Text(ThisRecord.categories),
     WebLink: Text(ThisRecord.webLink),
     Location: Text(ThisRecord.location),
     Importance: Text(ThisRecord.importance),
     IsAllDay: Boolean(ThisRecord.isAllDay),
     Recurrence: Text(ThisRecord.recurrence),
     ReminderMinutesBeforeStart: Value(ThisRecord.reminderMinutesBeforeStart),
     IsReminderOn: Boolean(ThisRecord.isReminderOn),
     ShowAs: Text(ThisRecord.showAs),
     ResponseRequested: Boolean(ThisRecord.responseRequested),
     Sensitivity: Text(ThisRecord.sensitivity)
     }
     )
    );

     

    Change the Items property of CalendarEventsGallery to 

    SortByColumns(Filter(myCollection, Text(Start, DateTimeFormat.ShortDate) = Text(_dateSelected, DateTimeFormat.ShortDate)), "Start")

     

    Delete the Dropdown

     

    Change the OnSelect property of the Left arrow to 

    /*changes month view to previous month*/
    Set(_firstDayOfMonth, DateAdd(_firstDayOfMonth, -1, TimeUnit.Months));
    Set(_firstDayInView, DateAdd(_firstDayOfMonth, -(Weekday(_firstDayOfMonth) - 2 + 1), TimeUnit.Days));
    Set(_lastDayOfMonth, DateAdd(DateAdd(_firstDayOfMonth, 1, TimeUnit.Months), -1, TimeUnit.Days));
    /*collects calendar events for all days in current month view. Updates _minDate to prevent duplicate data collection if user returns to this month view*/
    If(_minDate > _firstDayOfMonth, Set(_minDate, _firstDayOfMonth);
    Set(varCalendarItems, test0008.Run(Text(_minDate, DateTimeFormat.UTC),Text(_maxDate, DateTimeFormat.UTC)).response); // Replace the test0008 with your Flow name
    Set(parsedItems, ParseJSON(varCalendarItems));
    
    // Create a collection from the parsed items
    ClearCollect(
     myCollection,
     ForAll(
     parsedItems,
     {
     Subject: Text(ThisRecord.subject),
     Start: DateTimeValue(ThisRecord.start),
     End: DateTimeValue(ThisRecord.end),
     StartWithTimeZone: Text(ThisRecord.startWithTimeZone),
     EndWithTimeZone: Text(ThisRecord.endWithTimeZone),
     Body: Text(ThisRecord.body),
     IsHtml: Boolean(ThisRecord.isHtml),
     ResponseType: Text(ThisRecord.responseType),
     ResponseTime: DateTimeValue(ThisRecord.responseTime),
     Id: Text(ThisRecord.id),
     CreatedDateTime: DateTimeValue(ThisRecord.createdDateTime),
     LastModifiedDateTime: DateTimeValue(ThisRecord.lastModifiedDateTime),
     Organizer: Text(ThisRecord.organizer),
     TimeZone: Text(ThisRecord.timeZone),
     ICalUId: Text(ThisRecord.iCalUId),
     Categories: Text(ThisRecord.categories),
     WebLink: Text(ThisRecord.webLink),
     Location: Text(ThisRecord.location),
     Importance: Text(ThisRecord.importance),
     IsAllDay: Boolean(ThisRecord.isAllDay),
     Recurrence: Text(ThisRecord.recurrence),
     ReminderMinutesBeforeStart: Value(ThisRecord.reminderMinutesBeforeStart),
     IsReminderOn: Boolean(ThisRecord.isReminderOn),
     ShowAs: Text(ThisRecord.showAs),
     ResponseRequested: Boolean(ThisRecord.responseRequested),
     Sensitivity: Text(ThisRecord.sensitivity)
     }
     )
    );)

     

    Change the OnSelect property of the Right arrow to

    /*changes month view to next month*/
    Set(_firstDayOfMonth, DateAdd(_firstDayOfMonth, 1, TimeUnit.Months));
    Set(_firstDayInView, DateAdd(_firstDayOfMonth, -(Weekday(_firstDayOfMonth) - 2 + 1), TimeUnit.Days));
    /*collects calendar events for all days in current month view. Updates _maxDate to prevent duplicate data collection if user returns to this month view*/
    Set(_lastDayOfMonth, DateAdd(DateAdd(_firstDayOfMonth, 1, TimeUnit.Months), -1, TimeUnit.Days));
    If(_lastDayOfMonth > _maxDate, Set(_maxDate, _lastDayOfMonth); Set(varCalendarItems, test0008.Run(Text(_minDate, DateTimeFormat.UTC),Text(_maxDate, DateTimeFormat.UTC)).response); // Replace the test0008 with your Flow name
    Set(parsedItems, ParseJSON(varCalendarItems));
    
    // Create a collection from the parsed items
    ClearCollect(
     myCollection,
     ForAll(
     parsedItems,
     {
     Subject: Text(ThisRecord.subject),
     Start: DateTimeValue(ThisRecord.start),
     End: DateTimeValue(ThisRecord.end),
     StartWithTimeZone: Text(ThisRecord.startWithTimeZone),
     EndWithTimeZone: Text(ThisRecord.endWithTimeZone),
     Body: Text(ThisRecord.body),
     IsHtml: Boolean(ThisRecord.isHtml),
     ResponseType: Text(ThisRecord.responseType),
     ResponseTime: DateTimeValue(ThisRecord.responseTime),
     Id: Text(ThisRecord.id),
     CreatedDateTime: DateTimeValue(ThisRecord.createdDateTime),
     LastModifiedDateTime: DateTimeValue(ThisRecord.lastModifiedDateTime),
     Organizer: Text(ThisRecord.organizer),
     TimeZone: Text(ThisRecord.timeZone),
     ICalUId: Text(ThisRecord.iCalUId),
     Categories: Text(ThisRecord.categories),
     WebLink: Text(ThisRecord.webLink),
     Location: Text(ThisRecord.location),
     Importance: Text(ThisRecord.importance),
     IsAllDay: Boolean(ThisRecord.isAllDay),
     Recurrence: Text(ThisRecord.recurrence),
     ReminderMinutesBeforeStart: Value(ThisRecord.reminderMinutesBeforeStart),
     IsReminderOn: Boolean(ThisRecord.isReminderOn),
     ShowAs: Text(ThisRecord.showAs),
     ResponseRequested: Boolean(ThisRecord.responseRequested),
     Sensitivity: Text(ThisRecord.sensitivity)
     }
     )
    );)

     

    Change the circle inside the MonthDayGallery to:

    CountRows(Filter(myCollection, DateValue(Text(Start)) = DateAdd(_firstDayInView,ThisItem.Value, TimeUnit.Days))) > 0 && !Subcircle2.Visible && Title6.Visible

     

    1. Drag and drop the arrow, calendar etc.. to better location.
  • ANB Profile Picture
    ANB 6,926 on at
    Re: Add only one calendar from Outlook to PowerApps

    @diegonoyola As per https://learn.microsoft.com/en-us/connectors/office365/

    Please check General known issues and limitations for Office365 Outlook connector:

    ANB_0-1720641045370.png

     

    -----------------------------------------------------------------------------------------------------------------------------

    I hope this helps.

    Please click Accept as solution ✅ if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs up.👍

    Thanks,
    ANB


     

  • diegonoyola Profile Picture
    diegonoyola 10 on at
    Re: Add only one calendar from Outlook to PowerApps

    If I share the calendar with the people, will they be able to see the calendar thru the control app?

     

  • michalparal222 Profile Picture
    michalparal222 86 on at
    Re: Add only one calendar from Outlook to PowerApps

    Hi @diegonoyola ,

     

    in the Items property of the Dropdown you can filter the specific calendar for example:

    Filter( Office365Outlook.CalendarGetTables().value, DisplayName = "Calendar"

    But keep in mind that when you Publish and Share the app, users will not see the Outlook calendar of a specific user, they will see they own calendars. 
    You could use a SharePoint list instead of the outlook calendar to achieve that everyone will see the same data.

    If my response resolved your issue, please mark it as the solution by clicking "Accept as solution" so others can find the answer.

     

  • ANB Profile Picture
    ANB 6,926 on at
    Re: Add only one calendar from Outlook to PowerApps

    Hi @diegonoyola Have you tried this? For this you need to add Office365 Outlook connector in app

     

    Office365Outlook.CalendarGetTablesV2().value

     

    This will returns a table of all calendar and then you can do a lookup to get one specific calendar with Name.

     

    Lookup(Office365Outlook.CalendarGetTablesV2().value, name = "NameOfCalendar")

     

    -----------------------------------------------------------------------------------------------------------------------------

    I hope this helps.

    Please click Accept as solution ✅ if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs up.👍

    Thanks,
    ANB


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

October 2024 Newsletter…

October 2024 Community Newsletter…

Community Update Oct 28…

Power Platform Community Update…

Tuesday Tip #4 How to Conntact Support…

Welcome to a brand new series, Tuesday Tips…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 142,651

#2
RandyHayes Profile Picture

RandyHayes 76,308

#3
Pstork1 Profile Picture

Pstork1 63,727

Leaderboard