Monday, February 6, 2012

SharePoint Calendar Setting a default duration for new Events as Outlook

First of all i would like to thank Ryan for his post on Setting a default duration for new SharePoint Calender Events, which helped me in providing a better solution to my client.

However I have updated the script for my requirement to auto-updating the end date time based on start date time, not only for the first time load but also for consequent start date time changes similar to Outlook functionality.
Note: The outlook loads the 30 mins duration for first time and for any consequent duration change by changing the end date time, it keeps the updated duration for start time change.

My updated JavaScript has below functionality:
1. Sets the default duration to 30 mins on first time load
2. It updates the end date time accordingly on updating start date, start hours or start minutes.
3. It provides the similar functionality as Outlook, sets the default duration 30 mins and keeps the updated duration (by changing the end date time) and doesn't allow end date time less than current date time.
4. It works for All Day, Recurrence and All Day + Recurrence Events

To apply the functionality follow the below simple steps:
1. Go to Calendar -> Click “New” in your Calendar to open up NewForm.aspx
2. Edit New Form -> Add a query string &ToolPaneView=2 onto the end of the URL to open the page in edit mode
3. Add a Content Editor Web Part to the page (below the New Form)
4. Click Open the toolpane or Edit > Modify Share Web Part
5. Click Source Editor and paste in the following JavaScript

JavaScript to auto-update end date time with a specific duration with start date time.


3 comments:

  1. This doesn't seem to work in SharePoint 2010. Is there a solution that does?

    ReplyDelete
  2. Charlie, to apply the script it needs to be placed on the popup (new form) page. But there is no direct way to add a content editor to popup. However i will investigate further and update you if i can make any progress.

    ReplyDelete
  3. I added this script to a .txt file and added it to the resource library and edit the new form webpart in SP 2010, it didn't work.
    Have you tested this in SP 2010? Is there an alternate solution?

    ReplyDelete