Question

Using SharePoint 2016 on-premises and I have a task list where I would like to prevent the creation of new items when the value of column Date is a Holiday. How can I do this?

Was it helpful?

Solution

You can do this with a validation formula. It can get quite long, depending on the number of holidays, and how far out into the future you want to go.

=NOT( OR( [TaskDate]=Date(2019,12,25),
          [TaskDate]=Date(2020,1,1),
          [TaskDate]=Date(2020,4,1)
        )
    )

You can also block weekend days in a similar manner:

=NOT( OR( WEEKDAY( [TaskDate], 2 )=6, WEEKDAY([TaskDate],2)=7 ) )

The "2" indicates that days are numbered and 1 (Monday) to 7 (Sunday).

OTHER TIPS

One option coould be to use Column Validation, however it might be tricky to define a formula for 'holiday' Another option could be to create an event receiver on ItemAdding, there you can check the date against a SPlist that defines the start and end date for holidays ( or similar setup)

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top