cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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
Highlighted
Super User III
Super User III

Re: Problem with date in Calendar

@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. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.

View solution in original post

Highlighted
Helper II
Helper II

Re: Problem with date in Calendar

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
Highlighted
Super User III
Super User III

Re: Problem with date in Calendar

@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. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.

View solution in original post

Highlighted
Helper II
Helper II

Re: Problem with date in Calendar

Good morning,

 

yes! it works!! Thank you very much, 

 

Highlighted
Helper II
Helper II

Re: Problem with date in Calendar

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

Highlighted
Super User III
Super User III

Re: Problem with date in Calendar

@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. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Highlighted
Helper II
Helper II

Re: Problem with date in Calendar

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,

 

Highlighted
Super User III
Super User III

Re: Problem with date in Calendar

@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. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Highlighted
Helper II
Helper II

Re: Problem with date in Calendar

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

Highlighted
Super User III
Super User III

Re: Problem with date in Calendar

@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. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Highlighted
Helper II
Helper II

Re: Problem with date in Calendar

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
Community Conference

Power Platform Community Conference

Find your favorite faces from the community presenting at the Power Platform Community Conference!

Watch Now

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (5,782)