cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
SilentUK
Advocate II
Advocate II

GetEventsCalendarViewV2 failed - Invalid value for parameter 'End Time'

I am using the Out of office template app and when it loads it runs the following code:

Concurrent(
    ClearCollect(FutureCalendarEvents, Office365.GetEventsCalendarViewV2(_myCalendarID, Text(Now(), UTC), Text(DateAdd(Now(), 90, Days))).value),
    ClearCollect(MyPeople, RenameColumns(Office365Users.RelevantPeople(_myProfile.Id).value, 
      "birthday", "Birthday", "companyName", "CompanyName", "department", "Department", "displayName", "DisplayName", "givenName", "GivenName", "id", "Id", "jobTitle",        "JobTitle", "officeLocation", "OfficeLocation", "userPrincipalName", "UserPrincipalName")
    )
)

This errors and gives the message:

Office365.GetEventsCalendarViewV2 failed: { "status": 400, "message": "Invalid value '25/02/2020 10:52' for parameter 'End Time'.\r\nclientRequestId: 888ce825-e3be-4fa7-affb-ba416ccc0fa0", "source": "office365-ukw.azconn-ukw-01.p.azurewebsites.net" }

 I've tried changing the formula to look at only 5 days instead of the next 90, and this gives a different error that states "The start time must be before the end time" or something along those lines.


I'm not sure what is causing this to not function, it clearly gets a date/time for the end time but for whatever reason cannot compare it to the start.  Really not sure what I've done to break this!  Could someone offer some expert advise please?

1 ACCEPTED SOLUTION

Accepted Solutions
yashag2255
Dual Super User II
Dual Super User II

Hey @SilentUK 

 

I carried out a few tests in my side, and you can update the configuration as:

1) Add a connection to Office 365 Outlook, if this does not exists already.
2) Concurrent(ClearCollect(FutureCalendarEvents, Office365Outlook.GetEventsCalendarViewV3((_myCalendarID, Text(Now(), UTC), Text(DateAdd(Now(), 90, Days))).value),
ClearCollect(MyPeople, RenameColumns(Office365Users.RelevantPeople(_myProfile.Id).value,
"birthday", "Birthday", "companyName", "CompanyName", "department", "Department", "displayName", "DisplayName", "givenName", "GivenName", "id", "Id", "jobTitle", "JobTitle", "officeLocation", "OfficeLocation", "userPrincipalName", "UserPrincipalName")
)
)

Here, since the previous function is deprecated, the way to call the new function is through Office365Outlook.GetEventsCalendarViewV3()

 

Hope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

7 REPLIES 7
yashag2255
Dual Super User II
Dual Super User II

Hey @SilentUK 

 

I am not able to replicate the issue that you mentioned. Have you made any other change on your side?

The formula changed to get the 5 days data is:

Concurrent(
ClearCollect(FutureCalendarEvents, Office365.GetEventsCalendarViewV2(_myCalendarID, Text(Now(), UTC), Text(DateAdd(Now(), 5, Days))).value),
ClearCollect(MyPeople, RenameColumns(Office365Users.RelevantPeople(_myProfile.Id).value, 
"birthday", "Birthday", "companyName", "CompanyName", "department", "Department", "displayName", "DisplayName", "givenName", "GivenName", "id", "Id", "jobTitle", "JobTitle", "officeLocation", "OfficeLocation", "userPrincipalName", "UserPrincipalName")
)
)

 

Hope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

Hi @yashag2255 

 

I have not made any additional changes on my end on the App On start code.  Only changes i've made to the app have been visual (Changing logos etc).

 

The entire "On Start" Code is as follows:

//gets user profile, sets count variables to 0, gets user calendar ID, creates time selection collection
Concurrent(
    Set(_myProfile, Office365Users.MyProfile()),
    Set(_clearedEventsCount, 0),
    Set(_inviteeCount, 0),
    Set(_myCalendarID, LookUp(Office365.CalendarGetTables().value, DisplayName = "Calendar").Name),
    ClearCollect(HoursList, 
     {Name:"12:00 am",Minutes:0}, {Name:"12:30 am",Minutes:30}, {Name:"01:00 am",Minutes:60}, {Name:"01:30 am",Minutes:90},
     {Name:"02:00 am",Minutes:120}, {Name:"02:30 am",Minutes:150}, {Name:"03:00 am",Minutes:180}, {Name:"03:30 am",Minutes:210},
     {Name:"04:00 am",Minutes:240}, {Name:"04:30 am",Minutes:270}, {Name:"05:00 am",Minutes:300}, {Name:"05:30 am",Minutes:330}, 
     {Name:"06:00 am",Minutes:360}, {Name:"06:30 am",Minutes:390}, {Name:"07:00 am",Minutes:420}, {Name:"07:30 am",Minutes:450}, 
     {Name:"08:00 am",Minutes:480}, {Name:"08:30 am",Minutes:510}, {Name:"09:00 am",Minutes:540}, {Name:"09:30 am",Minutes:570}, 
     {Name:"10:00 am",Minutes:600}, {Name:"10:30 am",Minutes:630}, {Name:"11:00 am",Minutes:660}, {Name:"11:30 am",Minutes:690}, 
     {Name:"12:00 pm",Minutes:720}, {Name:"12:30 pm",Minutes:750}, {Name:"01:00 pm",Minutes:780}, {Name:"01:30 pm",Minutes:810},
     {Name:"02:00 pm",Minutes:840}, {Name:"02:30 pm",Minutes:870}, {Name:"03:00 pm",Minutes:900}, {Name:"03:30 pm",Minutes:930},
     {Name:"04:00 pm",Minutes:960}, {Name:"04:30 pm",Minutes:990}, {Name:"05:00 pm",Minutes:1020}, {Name:"05:30 pm",Minutes:1050},
     {Name:"06:00 pm",Minutes:1080}, {Name:"06:30 pm",Minutes:1110}, {Name:"07:00 pm",Minutes:1140}, {Name:"07:30 pm",Minutes:1170},
     {Name:"08:00 pm",Minutes:1200}, {Name:"08:30 pm",Minutes:1230}, {Name:"09:00 pm",Minutes:1260}, {Name:"09:30 pm",Minutes:1290},
     {Name:"10:00 pm",Minutes:1320}, {Name:"10:30 pm",Minutes:1350}, {Name:"11:00 pm",Minutes:1380}, {Name:"11:30 pm",Minutes:1410}
    )

);
//gets user's calendar events for next 90 days, gets user's relevant people
Concurrent(
    ClearCollect(FutureCalendarEvents, Office365.GetEventsCalendarViewV2(_myCalendarID, Text(Now(), UTC), Text(DateAdd(Now(), 90, Days))).value),
    ClearCollect(MyPeople, RenameColumns(Office365Users.RelevantPeople(_myProfile.Id).value, 
      "birthday", "Birthday", "companyName", "CompanyName", "department", "Department", "displayName", "DisplayName", "givenName", "GivenName", "id", "Id", "jobTitle",        "JobTitle", "officeLocation", "OfficeLocation", "userPrincipalName", "UserPrincipalName")
    )
)

/* May be useful as a start to retrieve whether an OOF is currently active. Incomplete though, and will not work if uncommented.
Set(_myMailTips, Office365.GetMailTips(_myProfile.UserPrincipalName));
Set(_currOOF, LookUp(FutureCalendarEvents, 
    DateTimeValue(Start) <= Now() && DateTimeValue(End) > Now() && DateDiff(DateTimeValue(Start), DateTimeValue(End), Hours) >= 6 && !(_myProfile.UserPrincipalName in FutureCalendarEvents.RequiredAttendees) &&
    !(_myProfile.UserPrincipalName in FutureCalendarEvents.OptionalAttendees)));
If(!IsBlank(_myMailTips.AutomaticReplies.Message) && !IsBlank(_currOOF), Set(_createdOOF, true))
*/

When i use the 5 day code you provided instead of the above, I get the following error:

Office365.GetEventsCalendarViewV2 failed: { "status": 400, "message": "StartDateTime should be earlier or equal to EndDateTime.\r\nclientRequestId: 95defcbf-a189-4d6f-82a0-d3e0d569b3bc\r\nserviceRequestId: 31a3c175-586f-43de-87c2-2760bda4d371", "source": "office365-ukw.azconn-ukw-01.p.azurewebsites.net" }

Thank you.

yashag2255
Dual Super User II
Dual Super User II

Hi @SilentUK 

 

Based on Microsoft document, the function Office365.GetEventsCalendarViewV2 is deprecated. Please refer: https://docs.microsoft.com/en-us/connectors/office365/#get-calendar-view-of-events-(v2)-[deprecated] 

Can you try to update the formula to:
Concurrent(
ClearCollect(FutureCalendarEvents, Office365.GetEventsCalendarViewV3(_myCalendarID, Text(Now(), UTC), Text(DateAdd(Now(), 5, Days))).value),
ClearCollect(MyPeople, RenameColumns(Office365Users.RelevantPeople(_myProfile.Id).value,
"birthday", "Birthday", "companyName", "CompanyName", "department", "Department", "displayName", "DisplayName", "givenName", "GivenName", "id", "Id", "jobTitle", "JobTitle", "officeLocation", "OfficeLocation", "userPrincipalName", "UserPrincipalName")
)
)

Note: Try to refresh the office365 connection if this gives any errors.

 

Hope this Helps!

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

Thanks @yashag2255 

 

Unfortunately, I get an error with V3, i think it isn't supported in powerapps yet:

invalid.pnginvalid2.png

yashag2255
Dual Super User II
Dual Super User II

Hey @SilentUK 

 

I carried out a few tests in my side, and you can update the configuration as:

1) Add a connection to Office 365 Outlook, if this does not exists already.
2) Concurrent(ClearCollect(FutureCalendarEvents, Office365Outlook.GetEventsCalendarViewV3((_myCalendarID, Text(Now(), UTC), Text(DateAdd(Now(), 90, Days))).value),
ClearCollect(MyPeople, RenameColumns(Office365Users.RelevantPeople(_myProfile.Id).value,
"birthday", "Birthday", "companyName", "CompanyName", "department", "Department", "displayName", "DisplayName", "givenName", "GivenName", "id", "Id", "jobTitle", "JobTitle", "officeLocation", "OfficeLocation", "userPrincipalName", "UserPrincipalName")
)
)

Here, since the previous function is deprecated, the way to call the new function is through Office365Outlook.GetEventsCalendarViewV3()

 

Hope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

Thanks @yashag2255 .  The problem was I had an Office365 connection and I needed to be using the Office365Outlook Connection.  Adding that resolved it straight away.

 

Thank you.

CollabGuy93
Regular Visitor

Hello, there,

I think I have found the real reason why the error message regarding "End-Time" appears:

In the formula GetEventsCalendarView, unlike StartTime, EndTime lacks the complete Text() function which converts the value to UTC format. When I adjusted the formula accordingly, everything worked.

 

OutOfOffice-Formular-Error.png

 

Hope this helps some!

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Top Solution Authors
Top Kudoed Authors
Users online (52,755)