web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Problem with date in C...
Power Apps
Unanswered

Problem with date in Calendar

(0) ShareShare
ReportReport
Posted on by 83

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

 

Categories:
I have the same question (0)
  • Verified answer
    RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

    @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.

  • Biisorte Profile Picture
    83 on at

    Good morning,

     

    yes! it works!! Thank you very much, 

     

  • Biisorte Profile Picture
    83 on at

    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

  • RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

    @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.

  • Biisorte Profile Picture
    83 on at

    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,

     

  • RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

    @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.

  • Biisorte Profile Picture
    83 on at

    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

  • RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

    @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.

  • Verified answer
    Biisorte Profile Picture
    83 on at

    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!!!

     

  • RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

    @Biisorte 

    Always a journey of learning 🙂  

    Post again if you run into issue.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard