cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Markxx60
Helper I
Helper I

Date format for calendar invite

Hi I used Stalin Ponnusamy great example on creating a Calendar invite though PowerApps.

The app works find the issue I have is the date format being mm-dd-yyyy when we use dd-mm-yyyy.

I have a send invite button with the following code:

Markxx60_0-1659400963893.png

This is what I getting the date is in March when it should be August:

Markxx60_0-1659400805940.png

Thanks for any help to fix this I'm not an expect in PowerApps and do most of this by watch YouTube videos.

 

1 ACCEPTED SOLUTION

Accepted Solutions
BlessedCobba
Responsive Resident
Responsive Resident

Hi @Markxx60 

Def a brackets problem, try this 

 

Office365Outlook.V4CalendarPostItem(LookUp(Office365Outlook.CalendarGetTables().value, DisplayName = "Calendar").Name,
SubjectInput.Text,
Text(DateTimeValue(StartDatePicker.SelectedDate & " " & TimeValue(Concatenate(StartHour.Selected.Value,":",StartMinute.Selected.Value))),DateTimeFormat.UTC),
Text(DateTimeValue(EndDatePicker.SelectedDate & " " & TimeValue (Concatenate(EndHour.Selected.Value,":",EndMinute.Selected.Value))),DateTimeFormat.UTC),
"UTC",
{body: 'Email Content'.HtmlText,
requiredAttendees: Concat(RequiredAttendess.SelectedItems.Mail,Mail & ";"),
optionalAttendees: Concat(OptionalAttendess.SelectedItems.Mail,Mail & ";"),
isReminderOn: Reminder.Value,reminderMinutesBeforeStart: 15,responseRequested: ResponseRequested.Value}
)

 


and if you are still getting an error, try just putting small parts of the code into a label and make sure that individual part of the code is working

Example: Create a text label with just 

 

Text(DateTimeValue(EndDatePicker.SelectedDate & " " & TimeValue (Concatenate(EndHour.Selected.Value,":",EndMinute.Selected.Value))),DateTimeFormat.UTC)

 

and make sure this part is giving you a UTC time stamp, then try the next bit
I also find it helpful to format the code and start a new line after a ',' or a new section so you can look at it line by line to find faults

View solution in original post

9 REPLIES 9
BlessedCobba
Responsive Resident
Responsive Resident

Hi @Markxx60 

My country uses dd-mm-yyyy and this is the code i use to create calendar invites

 

 

Office365Outlook.V4CalendarPostItem( 
    LookUp(Office365Outlook.CalendarGetTables().value, DisplayName = "Calendar").Name,
    selectedDesk.Description,
    Text(startTime,DateTimeFormat.UTC),
    Text(endTime,DateTimeFormat.UTC),
    "UTC",
    {body: CalendarInviteBody.HtmlText }
)

 

 


The startTime & endTime is saved in a variable with this format 

 

 

Set(
    startTime,
   DateTimeValue(Text(selectedDate, ShortDate) &" " & TimeValue(ddTimeFrom_1.Selected.Value))
    
);

 

 


Instead of using the dateadd and the timezone offset, i just convert the date and time value to UTC and send to outlook.

One of the issues with how you currently have it is you have defined that you are sending the values in UTC format so it will read it as mm-dd-yyyy, its just easier to convert to UTC then send

Markxx60
Helper I
Helper I

Hi BlessedCobba,

Thanks for the reply I need to be spoon feed with this stuff. 

Markxx60_0-1659416977302.png

This is my booking screen and I assume your first bit of code goes on the OnSelect for the button.

Is the second bit of code on the datepicker format? I'm not a programmer and I really just stumble my way through this stuff.

Thanks.

BlessedCobba
Responsive Resident
Responsive Resident

Hi @Markxx60 

 

That's okay, easiest way to do it is to modify what you have, replace everything between subject.text, and {body with 

 

Text(DateTimeValue(StartDatePicker.SelectedDate & " " & TimeValue (Concatenate(StartHour.Selected.Value,":",StartMinute.Selected.Value)),DateTimeFormat.UTC),
Text(DateTimeValue(EndDatePicker.SelectedDate & " " & TimeValue (Concatenate(EndHour.Selected.Value,":",EndMinute.Selected.Value)),DateTimeFormat.UTC),"UTC",

 
This uses the DateTimeValue code that is already there, but instead of trying to do DateAdd around it all, it just takes the value that you have and simply converts it into UTC time  

Markxx60
Helper I
Helper I

Hi @BlessedCobba 

This is what I have now:

Office365Outlook.V4CalendarPostItem(LookUp(Office365Outlook.CalendarGetTables().value,DisplayName = "Calendar").Name,SubjectInput.Text,Text(DateTimeValue(StartDatePicker.SelectedDate & " " & TimeValue(Concatenate(StartHour.Selected.Value,":",StartMinute.Selected.Value)),DateTimeFormat.UTC,Text(DateTimeValue(EndDatePicker.SelectedDate & " " & TimeValue (Concatenate(EndHour.Selected.Value,":",EndMinute.Selected.Value)),DateTimeFormat.UTC,"UTC",{body: 'Email Content'.HtmlText,requiredAttendees: Concat(RequiredAttendess.SelectedItems.Mail,Mail & ";"),optionalAttendees: Concat(OptionalAttendess.SelectedItems.Mail,Mail & ";"),isReminderOn: Reminder.Value,reminderMinutesBeforeStart: 15,responseRequested: ResponseRequested.Value})

 

But I'm getting red squiggly lines from DateTimeValue(EndDatePicker.SelectedDate & " " & TimeValue (Concatenate(EndHour.Selected.Value,":",EndMinute.Selected.Value)),DateTimeFormat.UTC,"UTC",{body: 'Email Content'.HtmlText,requiredAttendees: Concat(RequiredAttendess.SelectedItems.Mail,Mail & ";"),optionalAttendees: Concat(OptionalAttendess.SelectedItems.Mail,Mail & ";"),isReminderOn: Reminder.Value,reminderMinutesBeforeStart: 15,responseRequested: ResponseRequested.Value})

 

I really appreciate you helping me with this

 

Markxx60
Helper I
Helper I

Hi @BlessedCobba 

I managed to remove the squiggly lines by closing a couple of brackets but now when I send I get language code 'dd/mm/yyyy 11:00' not supported.

It must be getting close 🙂

BlessedCobba
Responsive Resident
Responsive Resident

Hi @Markxx60

sounds like maybe i got some of the brackets wrong when i wrote it, if you are getting that error it means the 'DateTimeFormat.UTC' part of the code isnt working as it should convert your time to something like '2022-08-03T22:00:00.000Z' 

did you want to post and updated version of the code?, also if you chuck it in one of these things when posting its easier to read 

BlessedCobba_0-1659484296037.png

 



 

Markxx60
Helper I
Helper I

 

Office365Outlook.V4CalendarPostItem(LookUp(Office365Outlook.CalendarGetTables().value, DisplayName = "Calendar").Name,SubjectInput.Text,Text(DateTimeValue(StartDatePicker.SelectedDate & " " & TimeValue(Concatenate(StartHour.Selected.Value,":",StartMinute.Selected.Value))),DateTimeFormat.UTC,Text(DateTimeValue(EndDatePicker.SelectedDate & " " & TimeValue (Concatenate(EndHour.Selected.Value,":",EndMinute.Selected.Value))))),DateTimeFormat.UTC,"UTC",{body: 'Email Content'.HtmlText,requiredAttendees: Concat(RequiredAttendess.SelectedItems.Mail,Mail & ";"),optionalAttendees: Concat(OptionalAttendess.SelectedItems.Mail,Mail & ";"),isReminderOn: Reminder.Value,reminderMinutesBeforeStart: 15,responseRequested: ResponseRequested.Value})

Its weird because if I double click on the code the error goes away and I can run the app checker and it doesn't find an error but when I run the app and send an invite it doesn't send and the code then has the squiggly lines.

 

BlessedCobba
Responsive Resident
Responsive Resident

Hi @Markxx60 

Def a brackets problem, try this 

 

Office365Outlook.V4CalendarPostItem(LookUp(Office365Outlook.CalendarGetTables().value, DisplayName = "Calendar").Name,
SubjectInput.Text,
Text(DateTimeValue(StartDatePicker.SelectedDate & " " & TimeValue(Concatenate(StartHour.Selected.Value,":",StartMinute.Selected.Value))),DateTimeFormat.UTC),
Text(DateTimeValue(EndDatePicker.SelectedDate & " " & TimeValue (Concatenate(EndHour.Selected.Value,":",EndMinute.Selected.Value))),DateTimeFormat.UTC),
"UTC",
{body: 'Email Content'.HtmlText,
requiredAttendees: Concat(RequiredAttendess.SelectedItems.Mail,Mail & ";"),
optionalAttendees: Concat(OptionalAttendess.SelectedItems.Mail,Mail & ";"),
isReminderOn: Reminder.Value,reminderMinutesBeforeStart: 15,responseRequested: ResponseRequested.Value}
)

 


and if you are still getting an error, try just putting small parts of the code into a label and make sure that individual part of the code is working

Example: Create a text label with just 

 

Text(DateTimeValue(EndDatePicker.SelectedDate & " " & TimeValue (Concatenate(EndHour.Selected.Value,":",EndMinute.Selected.Value))),DateTimeFormat.UTC)

 

and make sure this part is giving you a UTC time stamp, then try the next bit
I also find it helpful to format the code and start a new line after a ',' or a new section so you can look at it line by line to find faults

Hi @BlessedCobba 

That worked thank you very much for your time and patience and I really do appreciate your help with this.

Regards

Helpful resources

Announcements
Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Super User 2 - 2022 Congratulations

Welcome Super Users

The Super User program for 2022 - Season 2 has kicked off!

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Users online (3,387)