cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ReinerKnudsen
Frequent Visitor

Create Event in Outlook calendar - Date format invalid

Hi there, 

I'm trying to create a new event from my PowerApp in a connected Outlook calendar.

I established the connection and it is working fine. I can access my calendar, read events... I also made sure that timezones on my computer and Microsoft 365 are the same. Plus I watched both videos by Todd and Shane and did exactly what they did. And I went through the app "Out of Office" App.

So what do I do: I have a screen with four controls

- two date pickers (StartDatePicker and EndDatePicker) and

- two drop downs (StartTimePicker and EndTimePicker)

From the drop downs I pick the time value which is linked to the number of minutes since midnight.

 

DateAdd( StartDatePicker.SelectedDate, StartTimePicker.Selected.Minutes, Minutes)

 

That gives me a proper date value. But when I send it to Outlook I get this error:

 

"String was not recognized as a valid DateTime.\r\nclientRequestId: 2dc28628-e60c-4f87-92fc-fd061c0de988"

 

Whatever I do with the date now I can't get it to work. 

Converting it via

 

DateTimeValue( Text( DateAdd( StartDatePicker.SelectedDate, StartTimePicker.Selected.Minutes, Minutes)))

 

doesn't make a difference.

I even took the date from the picker apart and split it into Day(), Month() and Year() and put it back in multiple ways:

Year()-Month()-Day(), Month()-Day()-Year()...

Each version triggers the same error except "Month()-Day()-Year()" which creates an event but on a wrong day (I sent 31 December 2020 and Outlook created an event on 12 July 2022).

I'm sure it is an issue with the date format but I can't get my head around it. The Monitor function is a big help in spotting the issue but I just don't understand why the message sent to Outlook

 

"body": {
    "subject": "Jenny & Reiner",
    "start": "20/07/2020 08:00",
    "end": "22/07/2020 09:30",
    "timeZone": "UTC",
    "body": "Erzeugt von Reiner Knudsen am 20/07/2020"
  }

 

Doesn't do what I want it to do.

HELP please!!!

Edited: I followed some advise here and change the PostItem call:

 

Office365Outlook.V4CalendarPostItem( 
    myCalendar.id, 
    Session.Group,
    DateTimeValue( Text( _startTimeUTC, DateTimeFormat.UTC)),
    DateTimeValue( Text( _endTimeUTC, DateTimeFormat.UTC)),
    "(UTC+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna",
    {body: "Erzeugt von " & User().FullName & " am " & Today()}
    );

 

with 

 

_startTimeUTC: DateAdd(varStartDatum, varStartZeit, Minutes),
_endTimeUTC: DateAdd(varEndeDatum, varEndeZeit, Minutes)

 

It still doesn't like the DateTimeFormat...

1 ACCEPTED SOLUTION

Accepted Solutions
ReinerKnudsen
Frequent Visitor

I solved this by moving back to the V2-Connector. And that one doesn't have an issue at all. Strange!

View solution in original post

4 REPLIES 4
ReinerKnudsen
Frequent Visitor

I solved this by moving back to the V2-Connector. And that one doesn't have an issue at all. Strange!

View solution in original post

Good tip, that V4 connector also gives me that problem.
😀

Thank you, I had the same error using V4 connector and was scratching my head for days. I've changed it to V2 and it is now working perfecytly!!

Joostson
New Member

Fixed, albeit in a clunky way. I'm working from a planner task assigned to me, and get the Start Date Time property. I cannot use it directly to create an Outlook Event as it contains a timezone, and the V4 connector needs a timestamp without timezone (date-no-tz).
The Start Date Time contains a value like this: "2021-11-01T10:00:00Z". It's the 'Z' (= Zulu time) that's causing the problem. To fix that, I put the Start Date Time in a variable:

Joostson_0-1636015274569.png

Then, I strip the 'Z' from the variable:

Joostson_1-1636015999500.png

The value contains: 

 

replace(triggerOutputs()?['body/startDateTime'], 'Z', '')

 

In this formula, replace triggerOutputs()?['body/startDateTime'] with your own string.

Note: If you're certain you always have a value for start date time, you can of course use the function of my second step directly. I do it in a second step because I check for null before trying to strip the 'Z'. Not all tasks in planner have a start date.

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (2,247)