cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Biisorte
Helper II
Helper II

Problem with date in Calendar

Good evening,

 

I'm having some problems when I post an item to a calendar. If I select my region language ("es" or "fr" or "ca-Es"...) it returns an error (not recognized as a valid Datetime) as you can see in the attached image. In the same image, you can see that the value of Datetimevalue is correct (18/3/2020, 15:15:00). Anybody can help me with this problem?

There is also something strange: when I select de english language ("en"), this error disappears and I can see in my calendar that it adds the event, but if I try to add an event in the current month it puts the event in march 2021 (???????). I don't understand anything...

 

Regards

 

2 ACCEPTED SOLUTIONS

Accepted Solutions
RandyHayes
Super User III
Super User III

@Biisorte 

First...yes,  when the day and month are not in the correct order, the datevalue function will convert based on anything given.  So, for example, if it is converting for mm/dd/yyyy then 14/3/2020 is Feb 3, 2021.   This is because it sees 14 as the month, and the 14th month of 2020 is Feb of 2021.  Anyway, you can throw "slop" at the datetime function and it will convert it.

 

For your formula, try changing it to the following:

Office365Outlook.V4CalendarPostItem(
      Lookup(Office365Outlook.CalendarGetTables().value; DisplayName="xxxxxx").Name;
      Label3_9.Text & " " & DropDown1_1.Selected.Value;
      Text(DateTimeValue(label15.Text; "ca-ES"); UTC);
      Text(DateTimeValue(Label15_1.Text; "ca-ES"); UTC);
      DateTimeZone.Local
)

 

I will assume that Label15 and Label15_1 are a concatenation of your datePicker and time dropdowns in a LongTime format.

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

View solution in original post

Hi RandyHayes,

 

I didn't know I could set the calendar post in a varible and at the same time publish the event in the calendar. As you can see, I'm new in Powerapps.

 

Many many thanks for your help. It works perfect!!!

 

View solution in original post

10 REPLIES 10
RandyHayes
Super User III
Super User III

@Biisorte 

First...yes,  when the day and month are not in the correct order, the datevalue function will convert based on anything given.  So, for example, if it is converting for mm/dd/yyyy then 14/3/2020 is Feb 3, 2021.   This is because it sees 14 as the month, and the 14th month of 2020 is Feb of 2021.  Anyway, you can throw "slop" at the datetime function and it will convert it.

 

For your formula, try changing it to the following:

Office365Outlook.V4CalendarPostItem(
      Lookup(Office365Outlook.CalendarGetTables().value; DisplayName="xxxxxx").Name;
      Label3_9.Text & " " & DropDown1_1.Selected.Value;
      Text(DateTimeValue(label15.Text; "ca-ES"); UTC);
      Text(DateTimeValue(Label15_1.Text; "ca-ES"); UTC);
      DateTimeZone.Local
)

 

I will assume that Label15 and Label15_1 are a concatenation of your datePicker and time dropdowns in a LongTime format.

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

View solution in original post

Good morning,

 

yes! it works!! Thank you very much, 

 

Good evening,

 

I have another question, sorry...

 

How Can I delete the item? If I use Office365Outlook.CalendarDeleteItemV2() I need the calendar ID and the Event Id, it's correct? I have the calendar ID, but I don't know how to get the Event ID.

 

Thank you

@Biisorte 

You can get the EventID from when you create the event.  The CalendarPostItem function will return a payload of information.  In that information will be the EventId that was just created.

If you are trying to do it after the item is created (i.e. at another point in time), then you will need to use the GetEventCalendarView function to get a list of events and then each will have its ID.  You can then use that for your delete.

If you are not providing an interface to "browse" through the events to choose which to delete, then you will need to store the eventID that was returned when created and then use that for your delete.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Hi RandyHayes,

 

thank you for your response.

This solution will be OK: "You can get the EventID from when you create the event.  The CalendarPostItem function will return a payload of information.  In that information will be the EventId that was just created." 

I can store the EventID in the Sharepoint list, because I patch the event in the list at the same time. But which is the function to get and store de EventID in this moment?

 

Thanks,

 

@Biisorte 

I'm not sure I understand your question - "But which is the function to get and store de EventID in this moment?"

As mentioned, the Create function you are using will return the details of the item created, including the EventID...that is where you would get the eventID and then you would store that.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Good morning RandyHayes,

 

when I create the event, I use this functions:

Patch( the event...) ;;

Office365Outlook.SendEmailV2( to send the creation of the event to an email...) ;;

Office365Outlook.V4CalendarPostItem( to create the event in my Outlook calendar...)

 

This functions work an I create the event in my sharepoint list with the patch, I receive an e-mail with the notice of the new event, and I see in the Outlook calendar my new event.

 

But I don't receive the details of the item created in the calendar. At least I don't know where this details are returned... 

 

Maybe if I create a new Calendar page in the App with my Outlook Calendar I could see these details?

 

Thank you

@Biisorte 

As mentioned, the Office365Outlook.V4CalendarPostItem will return the value you are looking for.

 

If you do something like this:   Set(postResult, Office365Outlook.V4CalendarPostItem(….))

Then your postResult variable will have the information returned from the function.

At that point postResult.id will contain the id of the event that was posted.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Hi RandyHayes,

 

I didn't know I could set the calendar post in a varible and at the same time publish the event in the calendar. As you can see, I'm new in Powerapps.

 

Many many thanks for your help. It works perfect!!!

 

View solution in original post

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

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Carousel April Dunnam Updated 768x460.jpg

Urdu Hindi D365 Bootcamp

Dont miss our very own April Dunnam’s The Developer Guide to the Galaxy! Find out what the Power Platform has to offer for the traditional developer.

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