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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / How to save a date to ...
Power Apps
Answered

How to save a date to a SharePoint List column when clicking on a date in a Power Apps calendar ?

(0) ShareShare
ReportReport
Posted on by 1,066
Dear experts,
 
I have made a calendar from the PowerApps template so i do not have to make the calendar from scratch.
Everything works fine. Accept i need it to do one last thing. And that is when i click on the date of the calendar
it has to save de date to a sharepoint list which also have a date column named "Datum". How can i do that?

So f.e. when i click on 30 on the PowerApps calendar it has to save the date 30 juni 2025 to my SharePoint List column.
 
 
This are the variables of the OnVisible of the form:
 
/*resets calendar view and date selection to today*/
Set(_dateSelected; Today());;
Set(_firstDayOfMonth; DateAdd(Today(); 1 - Day(Today()); TimeUnit.Days));;
Set(_firstDayInView; DateAdd(_firstDayOfMonth; -(Weekday(_firstDayOfMonth; StartOfWeek.Monday) -1) ; TimeUnit.Days));;
Set(_lastDayOfMonth; DateAdd(DateAdd(_firstDayOfMonth; 1; TimeUnit.Months); -1; TimeUnit.Days));;
Set(_calendarVisible;true);;
 
and this is the code of the Text property of the label in the Gallery:
Day(DateAdd(_firstDayInView;ThisItem.Value; TimeUnit.Days))

Gr. P
Categories:
I have the same question (0)
  • Suggested answer
    venturemavenwill Profile Picture
    1,198 Super User 2026 Season 1 on at
    Since the Text is actually the day representation of the date value, you can just use the actual date in your onclick property:
     
    Patch(
        SharePoint_List,
        Defaults(SharePoint_List),
        {
            Date: Text(DateAdd(_firstDayInView;ThisItem.Value; TimeUnit.Days), "dd mmm yyyy")
        }
    )
    This should create a new entry in the SharePoint list every time you click on a date. 
  • CU16021406-1 Profile Picture
    1,066 on at
    I get errors with this code:

    Patch(
        PKKalendarList;
        Defaults(PKKalendarList);
        {
            Datum: Text(DateAdd(_firstDayInView;ThisItem.Value; TimeUnit.Days), "dd mmm yyyy")
        }
    )
     
    And where should i put this code. I have no OnClick-event, but a OnSelect-event.
    And of which componten. The OnSelect of the Gallery or OnSelect of the label on the template card itserlf?

    Gr. P
  • Suggested answer
    venturemavenwill Profile Picture
    1,198 Super User 2026 Season 1 on at
    @CU16021406-1 you should add a transparent button to each gallery element. This will allow you to "click" on an element and have a reaction. 
     
    Also apologies - I missed a closing bracket. Try:
     
    Patch(
        SharePoint_List,
        Defaults(SharePoint_List),
        {
            Date: Text(DateAdd(_firstDayInView;ThisItem.Value; TimeUnit.Days), "dd mmm yyyy")
        }
    )
  • CU16021406-1 Profile Picture
    1,066 on at
    I did put a transparent button on it. But the code isn't working.
     
  • Suggested answer
    venturemavenwill Profile Picture
    1,198 Super User 2026 Season 1 on at
    @CU16021406-1 a closing bracket is missing
     
    yyyy") <- here
     
     
  • CU16021406-1 Profile Picture
    1,066 on at
    Even with an extra bracket the code does not work:

  • Verified answer
    venturemavenwill Profile Picture
    1,198 Super User 2026 Season 1 on at
    @CU16021406-1 but now you have one too many closing brackets? Also, what is your field type in SharePoint?
     
    If "Datum" is a date field, then you don't need the Text function. 

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 414

#2
Valantis Profile Picture

Valantis 408

#3
timl Profile Picture

timl 339 Super User 2026 Season 1

Last 30 days Overall leaderboard