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:
This is what I getting the date is in March when it should be August:
Thanks for any help to fix this I'm not an expect in PowerApps and do most of this by watch YouTube videos.
Solved! Go to Solution.
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 @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
Hi BlessedCobba,
Thanks for the reply I need to be spoon feed with this stuff.
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.
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
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
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 🙂
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
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.
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
That worked thank you very much for your time and patience and I really do appreciate your help with this.
Regards
User | Count |
---|---|
246 | |
103 | |
82 | |
49 | |
42 |