locked
Auto Refresh Sharepoint Calendar RRS feed

  • Question

  • Hi All,

      Is it possible to auto refresh a SharePoint calendar? I have been able to do this with javascript, but it refreshes the whole page which is not ideal. I've also looked at AJAX but it only seems to work in list view?

    Thanks

    Jon

    • Moved by Hemendra Agrawal Tuesday, March 5, 2013 5:30 AM not a programming issue
    Monday, March 4, 2013 8:00 PM

Answers

  • The JavaScript approach would be an easy solution to get the refresh working. Isolating it to a seperate page that can be used for monitoring would be a trade off. Adding new calendar items can still be done using the list, since the isolated page is part of the pages or site pages library.

    SharePoint Developer | @zeemanj | Blog

    • Marked as answer by star.wars Tuesday, March 12, 2013 9:28 AM
    Wednesday, March 6, 2013 8:51 PM

All replies

  • Some of the out of the box web parts have AJAX options. Unfortunately the calendar web part does not have this option. You would have to resort to either a JavaScript solution to refresh the whole page or to a custom SharePoint solution with calendar wrapped in a UpdatePanel. An UpdatePanel makes it possible that only a small part of the page is updated.


    SharePoint Developer | @zeemanj | Blog


    Monday, March 4, 2013 8:13 PM
  • Thanks for that. Could I use UpdatePanel to update the calendar webpart without it closing the newForm?

    I have a requirement to create a shared calendar in SharePoint, but there is the possibility that users may leave it open (therefore it will not be up-to-date). I could just refresh the page every few minutes, but it seems to close the new form that is opened when attempting to make a new booking....and if users part fill this in and have to walk away then they wouldn't be too happy to come back to no form.

    Any ideas? Its a shame Microsoft didn't include an auto refresh in the calendar...

    Many thanks.


    Monday, March 4, 2013 8:37 PM
  • Alternatively, as I expect there will only  be about 4 or 5 people with the calendar page open at any one time, I could use JavaScript to refresh the page.

    I guess my concerns with this would be keeping the newform open if the page is refreshed, to enable users to fill in part of the form and come back later if they need to. Is there a way to achieve this?


    Monday, March 4, 2013 8:57 PM
  • You'll have to create a custom solution with a custom control for the update panel approach. It involves quite some work to get the solution done.

    I would suggest taking the customization out of the list. You can create a page within the site and include the calendar web part on it. You can refresh the whole page at a specific interval. This page will then be used for display only. You won't have to change the SharePoint list forms and changes can still be made using the default list pages.


    SharePoint Developer | @zeemanj | Blog

    Tuesday, March 5, 2013 9:16 PM
  • Hi Jeffrey, thanks for that. I'm a bit confused though.

    If I include the calendar web part on a separate page, then use javascript to refresh the page, what happens if the user has the newform open for the calendar? I assume the whole lot gets refreshed, which would not be the perfect solution if the user leaves the form open half complete and comes back to find it gone :-(

    I can try tomorrow, but I have a bad feeling...

    The other option I thought of, if this doesn't work, was to open the newform in non modal mode when clicking the calendar - but i'm not a fan. If I can keep it in modal and still refresh the page without losing the filled in data (or not refresh when form is open) then this would be okay.

    Thanks

    Jon



    Tuesday, March 5, 2013 10:31 PM
  • The JavaScript approach would be an easy solution to get the refresh working. Isolating it to a seperate page that can be used for monitoring would be a trade off. Adding new calendar items can still be done using the list, since the isolated page is part of the pages or site pages library.

    SharePoint Developer | @zeemanj | Blog

    • Marked as answer by star.wars Tuesday, March 12, 2013 9:28 AM
    Wednesday, March 6, 2013 8:51 PM
  • with _MoveToViewDate

    if(window['ctx'+ctx.ctxId]['listTemplate']=='106'){_MoveToViewDate(null,'month',null);}



    • Edited by mossJLop Saturday, October 19, 2013 10:06 PM
    Saturday, October 19, 2013 10:05 PM