Recently, we had a requirement to sync the calendar between shared mailbox outlook and SharePoint Calendar list. We have created 2 flows:
- Outlook to SharePoint Sync – this one sync the changes in outlook calendar to SharePoint
- SharePoint to Outlook Sync – this one sync the changes in SharePoint calendar to Outlook.
When user enters any event in SharePoint calendar the second flow executes and tries to create new event in the shared mailbox outlook. We have used the Create event (v4) action. This action was giving below error in some cases:
Error - Your request can't be completed. At least one property failed validation.
Analysis:
- The first thing we need to check was in which scenario the error was occurring. So, when we analyze the issue, it was occurring for All day events only.
- The second thing we need to check was what was missing in the parameters? But we didn’t get anything missing in that.
- The third thing we check was where there any logic issue when we pass the parameters? In this we found the solution.
So, as we go through different steps in the analysis, we find that when pass parameters there is something went wrong. So, we passed the details as it is without making any changes in the data to outlook event and it completed successfully.
We have used below formula for converting the date –
formatDateTime(triggerOutputs()?['body/EndDate'],'yyyy-MM-ddTHH:mm')
The issue here was when we have all day event, the formula was setting the start date as “yyyy-MM-ddT12.00” and the end date was supplied as “yyyy-MM-ddT11.59”. The format was using AM/PM time but that was not passing in the create event. So, the end date was 1 min less than the start date and that was creating the issue.
We updated the format with below for 24-hour format:
formatDateTime(triggerOutputs()?['body/EndDate'],'yyyy-MM-ddTHH:mm:ssZ')
This resolved the issue for creating event. I have added reference link that explains formatDateTime function in detail. You can review that link for more format options.
Reference