One feature of SharePoint is to create a calendar and make it a group calendar. This allows the user to see the schedule of list of people at the same time on the same view as per the image below.
To configure the Calendar as a group Calendar you need to edit the List settings and then click on “List name, description and navigation” and finally select the radio button as per the image below.
So all this is SharePoint out of the box functionality. So where is the problem?
The problem is that to get the view of all calendar of your work group every time you open the calendar view you need to add each one of them individually! And I could not find any way to persist this information so that it would open the calendar view automatically with the people added as per the list you see in the first image. So lets get to work.
The way I fixed this is using Java script.
To be able to do this I used the following script.
var sel = SP.UI.ApplicationPages.CalendarSelector.instance().getSelector(1, 'WPQ12'); sel.selectEntities(ret, true);
You need two things to be able to perform the above script, the ID of the calendar web part (WPQ12 above) and the XML script to be able to add the required individuals. The way to do this is to follow the following steps:
function _firstTime() {
//need to select the calendar tab so we can override the onlick method on some of the buttons. SelectRibbonTab('Ribbon.Calendar.Calendar', true);
//give the ribbon time to load setTimeout('_doWireUp();',2000);
}
function _doWireUp() { //change the onclick event for the group buttons to make sure it reloads our default group var weekElem = document.getElementById('Ribbon.Calendar.Calendar.Scope.WeekGroup-Large'); if(weekElem) weekElem.onclick = function() {setTimeout('_setDefaultResources();',1000);return false;};
var dayElem = document.getElementById('Ribbon.Calendar.Calendar.Scope.DayGroup-Large');
if(dayElem) dayElem.onclick = function() {setTimeout('_setDefaultResources();',1000);return false;};
_setDefaultResources(); }
function _setDefaultResources() {
// This is the entities XML from step1 var ret ='\u003cEntities c…………………………………………………………………………………………………………..\u002fEntities\u003e';
// Put here the web part ID from step 2
var sel = SP.UI.ApplicationPages.CalendarSelector.instance().getSelector(1, 'WPQ12'); sel.selectEntities(ret, true); }
ExecuteOrDelayUntilScriptLoaded(_firstTime, "sp.ribbon.js");
Hi I am unable to find the var ret by using fiddler any detail description how to find or any other alternate solution to this will be higly appreciated.
Thanx in advance.
Regards,
Sabby
@Sabina - You may see "Response is encoded and may need to be decoded before inspection. Click here to transform." Above the Text view. Click that box.
You may also need to go into Fiddler Options, and select "Decrypt HTTPS traffic"
I'm still struggling with Step 4, myself ...
Hi, I'm unable to add script content editor (Step 4). getting error message as "
Follow this link to link the js file via a content editor web part. http://zepeda-mcmillan.blogspot.de/2011/03/displaying-default-resources-on-group.html
You should use the ID as 'WPQ2' to make it work. var sel = SP.UI.ApplicationPages.CalendarSelector.instance().getSelector(1, 'WPQ2'); Thanks for the detailed post !! It works !!
I tried setting this up but when I look at the IE Dev Console I see an error sayin "Unable to get property 'selectEntities' of undefined or null reference"Followed the steps provided and got the XML but doesn't seem to be rendering, help!
This worked great! One question though, when you switch to other views such as "Day", "Week", or "Month" and then go back to the "Week Group" view, the set of default users are no longer there. Can this be worked around as well? Thanks!
When I add the users and click OK, I don't get any new entries in Fiddler. As far as I can tell, it's definitely connected to the IE window in question, as an entry appears when I click to bring up the "add users" window (Host= Tunnel to; URL = our sharepoint address; Process = iexplore). Any ideas why this might be? Thanks!
thank you
It's possible apply such functionality in recurrent events? i'm trying in sharepoint code behind, but i have a lot of problems for make him possible, any help will be much appreciated.
it works well. Its a magic Thanks
Thank you very much for this post!! Works well and loads all resources at load time. You the man.
It works for me one week but after I installed last updates for Windows and sharepoint 2013 foundation it stopped working and I can't fix it :( have you any idea what I should to do? just uninstall last updates?
WOW how ridiculous!!!! This is something that should work out of the box and you need coding for this????? MS WAKE UP!!!!
Ridiculous what a simple function, why doesnt it work at the click of a button and why on earth would you only want to do this "temporarily" as MS put it. Cant belive all this work for something that should be out of box (as above)