I am basically willing to let the user select on which calendar some events should be saved to. Using Office365.CalendarGetTables() you can provide in a dropdown hss calendards. I would like to default the dropdown to the default calendar, but if it is a German user this calendar is named Kalender and in French Calendrier ... how should I go about defaulting to Calendar/Kalender/Calendrier/...?
Hi @CarlosMoreira70 ,
Could you please share a bit more about your scenario?
Do you want to display a default Calendar name within the Dropdown box based on the user's local language?
Based on the issue that you mentioned, I think the Language function could achieve your needs. I have made a test on my side, please take a try with the following workaround:
Set the Items property fo the Dropdown box to following:
DropColumns( AddColumns( Office365.CalendarGetTables().value, "CalendarName", If( DisplayName = "Calendar", If( /* <-- Based on user's locale, display corresponding Calendar name value */ Right(Language(),2) = "US", "Calendar", Right(Language(),2) = "FR", "Calendrier", Right(Language(),2) = "DE", "Kalender" ), DisplayName = "Birthdays", If( Right(Language(),2) = "US", "Birthdays", Right(Language(),2) = "FR", "Anniversaires", Right(Language(),2) = "DE", "Geburtstage" ), DisplayName = "United States holidays", If( Right(Language(),2) = "US", "United States holidays", Right(Language(),2) = "FR", "Vacances aux Etats-Unis", Right(Language(),2) = "DE", "USA Feiertage" ) ) ), "DisplayName" )
Then set the Default property of the Dropdown box to following:
If( Right(Language(),2) = "US", "Calendar", Right(Language(),2) = "FR", "Calendrier", Right(Language(),2) = "DE", "Kalender" )
More details about the Language function in PowerApps, please check the following article:
If you want to reference the Calendar Id from above Dropdown box (to create events), please consider use the following formula:
Dropdown1.Selected.Name /* <-- returns the Calendar Id for the selected Calendar name e.g. AAMkAGNlZWJhNDFhLWVkZDQtNGEwMi1hNGYxLWE4NjgxODQxYjE1OABGAAAAAADs9uoqJJanQrMetqhMVhx6BwCSaWLzoY45Rr_4uGphA-0GAAAAAAEGAACSaWLzoY45Rr_4uGphA-0GAAIdUAygAAA=*/
I can already display the calendar names in the user local language, that is the default provided back by the Office365.CalendarGetTables().value
But I cannot set the default value as the displayname is different based on the user regional settings
A French user will get the drop down defaulted to "Anniversaire" the first in alphabetical order
I guess I could indeed write an extensive set of if clauses to cover the 25+ languages of the users of the app to default to the "calendar"...
Hi @CarlosMoreira70 ,
Yeah, I agree with you. Based on the needs that you mentioned, I think there is no easy solution to achieve your needs.
As an available solution, I think the extensive set of if clauses may be a choice for you. I think the solution I provided above could achieve your needs, please consider take a try with it.
If you have solved your problem, please consider go ahead to click "Accept as Solution" to identify this thread has been solved.
Actually it seems more challenging than that. See below although I have French as my O365 language and it is picked up properly with language() the values retrieved from Office365.CalendarGetTables().value are in english in this specific case. But in 365 Outlook it is in French. Language() does not seem to be the right function to retrieve the name of the calendar. I have other cases where language() returns en-US and the Office365.CalendarGetTables().value returns Kalender ???
Watch Microsoft Business Applications Summit sessions on-demand.
The time has come: We are finally able to share more details on the brand-new ranks coming to the Power Apps Community!
Features releasing from April 2020 through September 2020