Tuesday, March 29, 2011

Displaying Default Resources on the Group Calendar

[IMPORTANT NOTE]  It has been pointed out that some of the forum users who have tried this solution cannot get it to work. I forgot to mention that I'm using JQuery-1.5.1.min.js, which is why you see $() references in the solution. You could use substitute the JQuery variable "ID" for the actual ID of the Web Part Zone, e.g. "WPQ1", but I would suggest uploading the JQuery min file to your Style Library and using the following reference:

<script src="/Style%20Library/JQuery-1.5.1.min.js" type="text/javascript">
</script>

Sorry for the miscommunication.

It's been awhile since I've posted any ground-breaking new discoveries, so I thought I would pass on a bit of info about the Group Calendar and displaying default groups. Disclaimer: this is still in beta, and not running on a production site yet.

I've stumbled across a few blog posts about the group calendar, and the need to display a default set of resources on the calendar. The OOB functionality requires the user to select a resource/resource group before items show up on the calendar. Being the stubborn developer that I am, I decided that I would come up with a fix for this based on a specific requirement from one of our Business Units. This solution works for Resource Groups, but I'm sure it can be modified to easily display resources or people, depending on your requirements.

Looking at the calendar in action, you will quickly realize that the calendar uses the picker dialog for selecting resources, and AJAX to render selected items on the calendar. So, how does one go about calling the necessary functions to populate the calendar? Magic! ;-)

I started by viewing the source of the parent page to get an idea of what was actually taking place when the picker dialog closes. Here is the event you are looking for:


Great! But how does this help you? You may notice that the dialog result is xml, and that setting the result requires a call to SP.UI.ApplicationPages.CalendarSelector.instance().getSelector(type, id). After a bit of searching in the SP.UI.Calendar.debug.js file, I found some information around the ResourceSelector and retrieving the selector type. If you do a search of the source code in your view source window for "add_resource", you'll see that the "Add Resources" link attribute "evtid" is "add_resource". Searching through the SP.UI.Calendar.debug.js on "add_resource" yielded this handy bit of information:

$p0.$z('add_resource', Function.createDelegate(this, function ($p1_0) {
            __spPickerDialogFunc(1, this.$w_1, true);
}));

This shows that the type is 1, and add = true. Once I had that information, I just needed to track down the XML data being passed from the picker dialog. That's where Fiddler comes in. If you aren't familiar with Fiddler, you should be. I won't go into too much detail, but will give you the gist below.

First, I opened an instance of fiddler and launched IE, browsing to my home page (which contains my group calendar). I then clicked the "Add Resources" link, and added a Resource Group called "All Computers" and clicked "OK".

You'll see below that the events now display for each resource in the calendar.


I then went into fiddler, and took a look at the final request from Picker.aspx, and began scanning the TextView for any information that might be helpful.




And there it is, in an ecma encoded string. The full XML return value from the dialog window. I copied the ret variable and began scripting a new function for the home page.

NOTE:  If you don't already know this, you can build your javascript into an html or txt file and upload it to a document library for reference in a Content Editor Web Part. I've found that if you just paste the javascript directly into the Content Editor, SharePoint has a nasty habit of correcting it for you, which can really break your code. I typically put my text/html files into a folder called "ctrl" in the Style Library. That way, if I reuse the code on multiple pages, I can update one single file and call it a day.

Here is my final script to populate the calendar:

<script type="text/javascript" src="/Style Library/Jquery.min.js"></script>
<script type="text/javascript">

function _setDefaultResources() {
        var el = $(".ms-acal-rootdiv");
        var xml = "\u003cEntities Append=\u0022True\u0022 Error=\u0022\u0022 DoEncodeErrorMessage=\u0022True\u0022 Separator=\u0022;\u0022 MaxHeight=\u00223\u0022\u003e\u003cEntity Key=\u0022All Computers\u0022 DisplayText=\u0022All Computers\u0022 IsResolved=\u0022True\u0022 Description=\u0022\u0022\u003e\u003cExtraData\u003e\u003cArrayOfDictionaryEntry xmlns:xsi=\u0022http:\u002f\u002fwww.w3.org\u002f2001\u002fXMLSchema-instance\u0022 xmlns:xsd=\u0022http:\u002f\u002fwww.w3.org\u002f2001\u002fXMLSchema\u0022\u003e\u003cDictionaryEntry\u003e\u003cKey xsi:type=\u0022xsd:string\u0022\u003eResourceMembers\u003c\u002fKey\u003e\u003cValue xsi:type=\u0022xsd:string\u0022\u003e1;#Computer 01;#2;#Computer 02;#3;#Computer 03;#4;#Computer 04;#5;#Computer 05;#6;#Computer 06;#7;#Computer 07;#8;#Computer 08;#9;#Computer 09;#10;#Computer 10;#11;#Computer 11;#12;#Computer 12;#13;#Computer 13;#14;#Computer 14;#15;#Computer 15\u003c\u002fValue\u003e\u003c\u002fDictionaryEntry\u003e\u003cDictionaryEntry\u003e\u003cKey xsi:type=\u0022xsd:string\u0022\u003eSPResourceId\u003c\u002fKey\u003e\u003cValue xsi:type=\u0022xsd:string\u0022\u003e30\u003c\u002fValue\u003e\u003c\u002fDictionaryEntry\u003e\u003cDictionaryEntry\u003e\u003cKey xsi:type=\u0022xsd:string\u0022\u003ePrincipalType\u003c\u002fKey\u003e\u003cValue xsi:type=\u0022xsd:string\u0022\u003eResourceGroup\u003c\u002fValue\u003e\u003c\u002fDictionaryEntry\u003e\u003c\u002fArrayOfDictionaryEntry\u003e\u003c\u002fExtraData\u003e\u003cMultipleMatches \u002f\u003e\u003c\u002fEntity\u003e\u003c\u002fEntities\u003e";


        var sel = SP.UI.ApplicationPages.CalendarSelector.instance().getSelector(1, $(el).attr('ctxid'));
        sel.selectEntities(xml, true);
}
 
ExecuteOrDelayUntilScriptLoaded(_setDefaultResources, "sp.ribbon.js");
</script>

A few important items to note... if you have multiple calendars on a single page, you will need to find the id of the calendar you are populating. The ctxid is actually a dynamically populated id (via javascript) of the web part context, which in this case is WPQ2. Make sure that you are using the ExecuteOrDelayUntilScriptLoaded( function, "sp.ribbon.js") call. The context id of the web part is not assigned until sp.ribbon.js is fully loaded. Once you have all that, it will work like a charm.

As always, if you have any questions, feel free to ping me. Hopefully, this will save you some time and make you look like a rockstar!

63 comments:

  1. This worked great. Thanks for the information. I would like to create a second calendar view for a different group of resources. I'm not quite sure how to identify the right calendar by ID and what code I would need to add to make this happen. Can you add information on how this could be accomplished?

    Thanks again.

    ReplyDelete
  2. That's a great question! What I typically do is view source on the web part page and do a search for the title of my web part, e.g. Group Calendar Computer Lab. What you'll need to do after that is look for the <td id="MSOZoneCell_WebPartWPQ[number]" that surrounds the web part. the WPQ[number] is the ID you are looking for when populating the selector using my script.

    As I mentioned in my post, WPQ2 was the context ID that I needed, but your web part may have another context ID. The context ID is always in the WPQ[number] format however.

    ReplyDelete
    Replies
    1. Hi Thomas

      Thanks for you awesome workaround.
      Where multiple calendar are placed on the page, would this be the correct format to use?

      var sel = SP.UI.ApplicationPages.CalendarSelector.instance().getSelector(1, $(el).attr('WPQ3'));

      Delete
    2. I think you have to do it like this:

      var sel = SP.UI.ApplicationPages.CalendarSelector.instance().getSelector(1, "WPQ3");

      Delete
  3. That’s brilliant! Thanks for sharing it. Can you think of a way of dynamically generating the list of items and pumping it back into your functions? I’m just thinking of the long term maintenance.

    I could maybe do it with a back end powershell script that queried the resource list and generated a JavaScript file with a variable ‘items’ or something, but that seems overly complex.

    ReplyDelete
  4. Aaron,

    Resources are stored in a list in SharePoint. You can easily query list data via javascript/jQuery using Marc Anderson's SPServices jQuery library:

    http://spservices.codeplex.com/

    The trick would be to format the response into accepted XML format so you could pass it back in to the Calendar Selector. I'm sure you could do a javascript replace with a dynamic string, similar to .NET String.Format('{0}', variable). I'll play around with it when I have some free time, and let you know what I come up with, but it wouldn't be too difficult.

    ReplyDelete
  5. Hi Thomas, i’v got something that works but it’s very messy.

    Iv taken your code and added a variable items that is included when setting them xml variable.

    Then built an empty data view in SharePoint designer after a lot of trail and error, filled it with (ID), (Name) from resources and formatted it so it pumped out the correctly formatted text:

    “#5;#Canon EOS 5D Digital SLR;#6;#Laptop1: Macbook pro;#7;#temp1;#8;#temp2;#9;#time3”

    Then played around with the XSL code so that it stored the text into a JavaScript variable items.

    Then added both web parts to the page with the calendad and it worked.

    Sorry I’m more of a network administrator than developer, so not really that easy to follow and not very clean but it works.

    Ill give SPServices a go.

    ReplyDelete
  6. Hi Thomas!

    I wanted to use this soution but i can't do what is suposed to be done. Like, where do i find the Style Library and how can i put there a doccument and make the rest..!

    Keep in mind that i started today "playing" with Sharepoint!

    Thank you ! :)

    ReplyDelete
  7. Anonymous,

    First off, thanks for your interest. I would suggest a few basic links to help get you started in SharePoint. One of my favorite sites is http://channel9.msdn.com/. There is a tremendous amount of information on this site, and some really good videos.

    The Style Library is located at your top-level SharePoint site, e.g. http://[siteurl]/Style Library/ or if you are in a site collection below the top-level site, http://[siteurl]/sites/[site name]/Style Library. You can also get to the Style Library using the Site Actions menu "Site Actions > View All Site Content > Style Library.

    I typically use the Style Library for all of my SharePoint resources within a site such as: custom css, custom html, custom javascript, and global images. If you don't have access to the style library though, you can use a document library and upload your files there.

    I would definitely suggest starting with a few training videos to see how SharePoint works. Focus on the content editor web part, as this is how you will include your script on the page where your calendar is being displayed.

    Thomas

    ReplyDelete
  8. Thomas, i forgot to say my name! It´s André!

    I would start to see some videos on content editor web part so i can understand a little better that part!

    Thank you for your time and quickness :)

    André

    ReplyDelete
  9. Hi Thomas!

    I have found a way to do what you have told and created a Content Editor Web Part and made a link to the txt file that you have told.

    Then in the Style Library linked the j.query to the file.

    But it´s not working, the only diference is the ribon in the top it's missing.

    What can i do?

    Tks for the help :)

    André

    ReplyDelete
  10. Hello,

    thanks for this great post, it works fine :)

    By the way, do you have any clue on how to get it work to populate users ?

    Thanks
    Sylvain

    ReplyDelete
  11. Thank you so much for posting this, and to the commenters like Sylvain who provided additional info. You really saved my bacon. I blogged your solution here: http://amatterofdegree.typepad.com/a_matter_of_degree/2011/08/bacon-savers-1.html.

    ReplyDelete
  12. I'm following the procedures but I can't go any further beyond "Here is my final script to populate the calendar:"

    I've created the javascript files and saved in /Style Library/ctrl/GroupCalendar.js

    So what's next? Sorry this question sounds stupid but I have no experience on dev.

    ReplyDelete
  13. Outstanding, really did the trick for moving my project forward. Only question I have is, when I goto create an event all my resouces are added, is there a way to remove them other then select all\remove? Or maybe I'm missing some thing not sure, let me know if you have some time.

    Thanks again...

    ReplyDelete
  14. hello,

    i am Jim from Italy. This script is great. Is there a possibility to delete the link "add ressources" in the view. So that a normal user can`t ad ressources.

    thank you

    ReplyDelete
  15. Hi
    this worked great for me both for resources and people.
    There is only 1 strange thing: in the group calendar page now i'm missing the "Calendar Tools" tab from the ribbon... I can only see the "Browse" tab.

    ReplyDelete
    Replies
    1. How do you get this to show people?

      Delete
    2. This comment has been removed by the author.

      Delete
  16. I guess it has something to do with having multiple web parts on a page... :(

    http://www.glynblogs.com/2011/02/list-view-selector-missing-with-multiple-web-parts-in-sharepoint-2010.html

    ReplyDelete
  17. I am encountering similar problem with Mr. Civilization... when I create an event, the system take all resources to next reservation form, is there anyway to book one particular resource instead of all?

    ReplyDelete
  18. A great post!
    I have a small project need help. Please contact me if you feel interest, my email: itseraph@gmail.com, thanks.

    ReplyDelete
  19. how do you add the script to sharepoint where do yo put it and how does it execute.

    ReplyDelete
    Replies
    1. Darren,

      You can add a script using the <script> tag in a content editor, or you can add it to the <head> tag using the <script> tag via SharePoint designer.

      T

      Delete
  20. What would I change to add 3 users for example

    and

    Jquery.min.js is that file already in Sharepoint or do I need to download it from somewhere and upload it to the SharePoint Server?

    and

    do I create an HTML page and paste this script in the head of the html page and then copy the whole lot into the content editor?

    thanks

    ReplyDelete
    Replies
    1. You need to follow the steps to determine what you need to pass via fiddler. At that point, you would modify the "var xml = " with the new values you get from fiddler.

      Delete
    2. I got the values from fiddler, added the jquery.min.js to my top level site and did the var sel2 line. What am I missing? It's still not working.

      Could someone post the entire code that works for people, not resources?

      Delete
  21. Hi Thomas,

    First of all thanks for this lovely tip.

    I' ve applied this to our SharePoint 2010 resources calendar but it works only on my user account, so it didn't work for other sharepoint users. Could you help me please, how can I populate the calendars for all users.

    Cheers

    ReplyDelete
  22. Hi Thomas,

    First of all thanks for this lovely tip.

    I' ve applied this to our SharePoint 2010 resource calendar but it works only on my user account, so it didn't work for other sharepoint users. Could you help me please, how can I populate the calendars for all users.

    Cheers

    ReplyDelete
    Replies
    1. Hi

      I had similar issue.
      For me the problem was that the other user did not have access to the jquery file.

      Delete
  23. Hi Everybody..

    I've got some issues with this "Workaround" can somebody help me please?

    I've done everything like it was written in the manual.. but i don't see any calendar? I don't know where's the issue and i don't know javascript very well :-/

    Thank you very much in advance!

    plon33r

    ReplyDelete
  24. I was actually looking for this resource a few weeks back. Thanks for sharing with us your wisdom.This will absolutely going to help me in my projects .


    ----------------------------------------------------------
    Flower Girl Dresses|Empire Wedding Dresses|New Style Wedding Dresses

    ReplyDelete
  25. hi could you help me please? I won't work on my sharepoint...

    ReplyDelete
  26. i need something to connect this script with exchange ... :/

    ReplyDelete
  27. Thanks its working perfectly!!!
    But is there any way so that it can show resources dynamically...
    also after adding script "Calendar Tools" tab disappeared and showing only Browse tab...
    Please help...

    ReplyDelete
  28. I got it!! I was trying to call the script from the Content Editor with a < script> tag -- wrong!!

    To do it correctly:
    http://sharepointadam.com/2010/08/31/insert-javascript-into-a-content-editor-web-part-cewp/

    MikeN

    ReplyDelete
  29. Very creative solution! Nice work.

    ReplyDelete
  30. I can't seem to make this work. I have a group work site (http://indev/juv/JSiteProject) as a subsite of team site (http://indev/juv).

    I have added the jquery.min.js file to http://indev/juv/JSiteProject/Style Library/jquery.min.js.

    I have added
    var sel2 = SP.UI.ApplicationPages.CalendarSelector.instance().getSelector(2, $(el).attr('ctxid'));
    sel2.selectEntities(xml2, true);

    I am trying to get this to work for two additional people besides me - glsumpter and soeagleton.

    ReplyDelete
    Replies
    1. Here is my code:

      Here is my code:
      script type="text/javascript" src="http://indev/juv/JSiteProject/Style Library/jquery.min.js" /script
      script type="text/javascript"

      function _setDefaultResources() {
      var el = $(".ms-acal-rootdiv");
      var xml ='\u003cEntities Append=\u0022True\u0022 Error=\u0022\u0022

      DoEncodeErrorMessage=\u0022True\u0022 Separator=\u0022;\u0022 MaxHeight=\u00223\u0022\u003e\u003cEntity

      Key=\u0022TARRANTCOUNTY\\soeagleton\u0022 DisplayText=\u0022Sheryl O. Eagleton\u0022

      IsResolved=\u0022True\u0022

      Description=\u0022TARRANTCOUNTY\\soeagleton\u0022\u003e\u003cExtraData\u003e\u003cArrayOfDictionaryEntry

      xmlns:xsi=\u0022http:\u002f\u002fwww.w3.org\u002f2001\u002fXMLSchema-instance\u0022

      xmlns:xsd=\u0022http:\u002f\u002fwww.w3.org\u002f2001\u002fXMLSchema\u0022\u003e\u003cDictionaryEntry\u003

      e\u003cKey xsi:type=\u0022xsd:string\u0022\u003eSPUserID\u003c\u002fKey\u003e\u003cValue

      xsi:type=\u0022xsd:string\u0022\u003e17\u003c\u002fValue\u003e\u003c\u002fDictionaryEntry\u003e\u003cDicti

      onaryEntry\u003e\u003cKey xsi:type=\u0022xsd:string\u0022\u003eAccountName\u003c\u002fKey\u003e\u003cValue

      xsi:type=\u0022xsd:string\u0022\u003eTARRANTCOUNTY\\soeagleton\u003c\u002fValue\u003e\u003c\u002fDictionar

      yEntry\u003e\u003cDictionaryEntry\u003e\u003cKey

      xsi:type=\u0022xsd:string\u0022\u003eEmail\u003c\u002fKey\u003e\u003cValue

      xsi:type=\u0022xsd:string\u0022\u003eSOEagleton@tarrantcounty.com\u003c\u002fValue\u003e\u003c\u002fDictio

      naryEntry\u003e\u003cDictionaryEntry\u003e\u003cKey

      xsi:type=\u0022xsd:string\u0022\u003ePrincipalType\u003c\u002fKey\u003e\u003cValue

      xsi:type=\u0022xsd:string\u0022\u003eUser\u003c\u002fValue\u003e\u003c\u002fDictionaryEntry\u003e\u003c\u0

      02fArrayOfDictionaryEntry\u003e\u003c\u002fExtraData\u003e\u003cMultipleMatches

      \u002f\u003e\u003c\u002fEntity\u003e\u003cEntity Key=\u0022TARRANTCOUNTY\\glsumpter\u0022

      DisplayText=\u0022Greg L. Sumpter\u0022 IsResolved=\u0022True\u0022

      Description=\u0022TARRANTCOUNTY\\glsumpter\u0022\u003e\u003cExtraData\u003e\u003cArrayOfDictionaryEntry

      xmlns:xsi=\u0022http:\u002f\u002fwww.w3.org\u002f2001\u002fXMLSchema-instance\u0022

      xmlns:xsd=\u0022http:\u002f\u002fwww.w3.org\u002f2001\u002fXMLSchema\u0022\u003e\u003cDictionaryEntry\u003

      e\u003cKey xsi:type=\u0022xsd:string\u0022\u003eSPUserID\u003c\u002fKey\u003e\u003cValue

      xsi:type=\u0022xsd:string\u0022\u003e16\u003c\u002fValue\u003e\u003c\u002fDictionaryEntry\u003e\u003cDicti

      onaryEntry\u003e\u003cKey xsi:type=\u0022xsd:string\u0022\u003eAccountName\u003c\u002fKey\u003e\u003cValue

      xsi:type=\u0022xsd:string\u0022\u003eTARRANTCOUNTY\\glsumpter\u003c\u002fValue\u003e\u003c\u002fDictionary

      Entry\u003e\u003cDictionaryEntry\u003e\u003cKey

      xsi:type=\u0022xsd:string\u0022\u003eEmail\u003c\u002fKey\u003e\u003cValue

      xsi:type=\u0022xsd:string\u0022\u003eGSumpter@TarrantCounty.com\u003c\u002fValue\u003e\u003c\u002fDictiona

      ryEntry\u003e\u003cDictionaryEntry\u003e\u003cKey

      xsi:type=\u0022xsd:string\u0022\u003ePrincipalType\u003c\u002fKey\u003e\u003cValue

      xsi:type=\u0022xsd:string\u0022\u003eUser\u003c\u002fValue\u003e\u003c\u002fDictionaryEntry\u003e\u003c\u0

      02fArrayOfDictionaryEntry\u003e\u003c\u002fExtraData\u003e\u003cMultipleMatches

      \u002f\u003e\u003c\u002fEntity\u003e\u003c\u002fEntities\u003e";



      var sel = SP.UI.ApplicationPages.CalendarSelector.instance().getSelector(1, $(el).attr('ctxid'));
      sel.selectEntities(xml, true);

      var sel2 = SP.UI.ApplicationPages.CalendarSelector.instance().getSelector(2, $(el).attr('ctxid'));
      sel2.selectEntities(xml2, true);
      }

      ExecuteOrDelayUntilScriptLoaded(_setDefaultResources, "sp.ribbon.js");

      /script

      Delete
  31. Hi Thomas,
    I really need the solution that you discovered but I am not an experienced SharePoint developer. I have the need to display three exchange calendars on a calendar that I have already created and have it working. I have the same problem of losing the exchange users every time I refresh. I copied your code from above and placed it in a txt file.

    However in SharePoint Designer (2010) I do not know how to add this code or the txt file. Is the code ultimately pasted into the html code in the default form? I also liked your tip about uploading the file to a specific style library but not sure how to do that either.

    I understand if it is too much to train a novice, but I would certainly appreciate it as my company will probably not spring for a 3rd party web part.

    ReplyDelete
  32. Hi Thomas, thanks for the script......however, i am quite new to the SharePoint designing, I have uploaded the script file under the "Style Library" folder....where i should refer this file, to have users appear on my calender?

    ReplyDelete
  33. You have done a great job, thanks.
    The only thing is that when i want to select one resource at a time, the list form display all Resources list so I have to Remove all resource first and keep the resource I need in the list.
    Is there any way that this could be resolved;

    ReplyDelete
  34. Hi,

    First of all, thank you for the tip. But is there any way I can display all booked resources in a month rather than a day or week?

    ReplyDelete
  35. Hi this was exactly what I needed thank you. I would if you could add to this. I have 2 calendars and I would to filter resources list (or at least set the default option) depending what calendar Is being used.

    https://picasaweb.google.com/105183582377932071609/January162013#5834086774468346802

    ReplyDelete
  36. Then added both web parts to the page with the calendad and it worked.



    _________________________________________________________________
    WoW Gold|Diablo 3 Gold|Swtor Credits|Aion kinah kaufen

    ReplyDelete
  37. I would start to see some videos on content editor web part so i can understand a little better that part!

    Thank you for your time and quickness :)


    ____________________________
    Cheap guild wars 2 gold
    here

    ReplyDelete
  38. Hi,

    It worked but now ie doesnt't show the resources and my calendar anymore.
    But is still works on Firefox and Chrome
    When i press F12 and debug it it says

    Unable to get property of undefined or null reference
    on sel.selectEntities(xml, true)

    ReplyDelete
  39. Hi,
    it works, Great job...Thanks..

    I tried to set week or month calendar view but without success. It set me only month calendar view without resources or only week group view. How to exactly modify the jquery to set week view ? Thanks

    ReplyDelete
  40. The solution works... you can use Firebug in Firefox or the Development Tools in I.E. 9.0 pressing F12... this way will return exactly the appropiate names of your libraries and resources.

    A couple issues that I found, in Sharepoint 2013 does hides the ribbon on execution. also only seem to work for Opera and Firefox. for Internet Explorer 8.0 and 9.0 does not return anything.

    I really miss the webpart in MOSS where a simple calendar can take care of Double Booking without have to involve resources. for a simple meeting room just a calendar with double booking validation is enough. but that does not seem to exist on Sharepoint 2013.

    Will keep looking for a way to activate teh ribbon and show the correct results in IE. but very nice attempt to make things work.

    ReplyDelete
  41. Hi Thomas,
    This is awesome post and It work fine,
    but in my scenario I have to display resource name dynamically on Group calendar.
    Means is there any resource added, deleted or updated same changes reflected on group calendar.
    So please suggest me how to do this.

    Thanks,
    Digambar K

    ReplyDelete
  42. Thanks for the post. It works great.
    Do you have any idea about using this trick with overlay? If I add an overlay view on my calendar it doesn't display its content because adding a resource only applies to the "base" view, and not the overlay view.
    Thanks.

    ReplyDelete
  43. Hello, my name is Juan Pablo am from Argentina.

    Achieve perform successfully the resources "rooms" are displayed correctly when loading the page.

    But I have a problem, I need you can see all the users of the organization in the same way and not just me.

    My code is as follows:


    var xml = "\u003cEntities Append=\u0022False\u0022 Error=\u0022\u0022 DoEncodeErrorMessage=\u0022True\u0022 Separator=\u0022;\u0022 MaxHeight=\u00223\u0022\u003e\u003cEntity Key=\u0022Sala 1 - Piso 12\u0022 DisplayText=\u0022Sala 1 - Piso 12\u0022 IsResolved=\u0022True\u0022 Description=\u0022\u0022\u003e\u003cExtraData\u003e\u003cArrayOfDictionaryEntry xmlns:xsi=\u0022http:\u002f\u002fwww.w3.org\u002f2001\u002fXMLSchema-instance\u0022 xmlns:xsd=\u0022http:\u002f\u002fwww.w3.org\u002f2001\u002fXMLSchema\u0022\u003e\u003cDictionaryEntry\u003e\u003cKey xsi:type=\u0022xsd:string\u0022\u003eSPResourceId\u003c\u002fKey\u003e\u003cValue xsi:type=\u0022xsd:string\u0022\u003e7\u003c\u002fValue\u003e\u003c\u002fDictionaryEntry\u003e\u003cDictionaryEntry\u003e\u003cKey xsi:type=\u0022xsd:string\u0022\u003ePrincipalType\u003c\u002fKey\u003e\u003cValue xsi:type=\u0022xsd:string\u0022\u003eResource\u003c\u002fValue\u003e\u003c\u002fDictionaryEntry\u003e\u003c\u002fArrayOfDictionaryEntry\u003e\u003c\u002fExtraData\u003e\u003cMultipleMatches \u002f\u003e\u003c\u002fEntity\u003e\u003cEntity Key=\u0022Sala 2 - Piso 12\u0022 DisplayText=\u0022Sala 2 - Piso 12\u0022 IsResolved=\u0022True\u0022 Description=\u0022\u0022\u003e\u003cExtraData\u003e\u003cArrayOfDictionaryEntry xmlns:xsi=\u0022http:\u002f\u002fwww.w3.org\u002f2001\u002fXMLSchema-instance\u0022 xmlns:xsd=\u0022http:\u002f\u002fwww.w3.org\u002f2001\u002fXMLSchema\u0022\u003e\u003cDictionaryEntry\u003e\u003cKey xsi:type=\u0022xsd:string\u0022\u003eSPResourceId\u003c\u002fKey\u003e\u003cValue xsi:type=\u0022xsd:string\u0022\u003e8\u003c\u002fValue\u003e\u003c\u002fDictionaryEntry\u003e\u003cDictionaryEntry\u003e\u003cKey xsi:type=\u0022xsd:string\u0022\u003ePrincipalType\u003c\u002fKey\u003e\u003cValue xsi:type=\u0022xsd:string\u0022\u003eResource\u003c\u002fValue\u003e\u003c\u002fDictionaryEntry\u003e\u003c\u002fArrayOfDictionaryEntry\u003e\u003c\u002fExtraData\u003e\u003cMultipleMatches \u002f\u003e\u003c\u002fEntity\u003e\u003c\u002fEntities\u003e";


    var sel = SP.UI.ApplicationPages.CalendarSelector.instance().getSelector(2, $(el).attr('ctxid'));
    sel.selectEntities(xml, true);
    }

    ExecuteOrDelayUntilScriptLoaded(_setDefaultResources, "sp.ribbon.js");


    We appreciate your help to accomplish this task.
    Thanks Regards.
    Juan Pablo

    ReplyDelete
  44. hi Thomas,

    It's very helpful. there's one problems that i would like to ask you, how can i added a function to filtering the category such as only Out of Office can be shown. Need your help. thank you before

    ReplyDelete
  45. Is this code work for SharePoint 2013 calendar.
    I tried this solution, but now the problem is it sometime showing in chrome and sometime not.And it not at all showing in IE 8,9...
    Please share your valuable ideas

    ReplyDelete
  46. Hi, Thanks for the great solution. I was implementing this and I am facing some issue while I am refreshing the page. For the first time when I refresh the page I am not getting WPQ2, so that sel is coming null. I tried a lot but not able to do this. Can you please help me on this. I am using in SharePoint 2013.

    ReplyDelete
  47. Another neat solution:

    http://sharepointzilla.blogspot.com/2013/07/sharepoint-2010-calendar-static.html?showComment=1427001801533#c1709366040636827107

    ReplyDelete
  48. We offer these, which may be used and copied, free of charge and provided that the copyright notice be removed. We can offer them, which can be easily downloadable and available in hard copy from our side. The printable calendars 2021are the designed calendars from January to December, which are offered by us.

    ReplyDelete
  49. Thank you so much for such information. In this age of busy lifestyle and hectic days, sometimes it's astonishing how we all stay organized and don't get mixed up all the performing activities. Why don’t you make use of January 2021 Calendar ? As you know calendar helps in managing your day and time promptly not only this by using calendar many tasks become quite easy and comfortable.

    ReplyDelete
  50. Very interesting article, I really appreciate it.
    Printable Things is that the authentic platform that famous for providing the best design 2022 Calendar Printable One Page to any or all people. Today's, calendar becomes the most convenient tool for planning for any events, holidays, special days, and a few personal meetings. The general public is unable to work out calendars because of their busy schedule.

    ReplyDelete
  51. Nice article, I really appreciate it.
    Download Basketball Score Sheet Printable from the Printable Things. It can help record numbers without mistakes while watching the sport. You have got to go to the website and click on the beginning to make a blank score sheet basketball scorebook. By downloading this you'll be able to make your scorekeeper. You’ll keep things like date, score, and so on.

    ReplyDelete
  52. This article is very nice, thank you for sharing with us.
    A rent/landlord verification form is used to verifying the tenant’s reliability. Visit the website of Printable Things to download the Sample Rental Verification Letter Pdf at freed from cost. A landlord who is going to give their home for renting then he would want proof that the applicant is ready both financially and socially to rent the house.

    ReplyDelete
  53. Many countries are with the land of diversity with different cultures, events, and festivals in January. Printable January 2022 Calendar with Holidays will reduce all stress and help to start a fresh start and mark dates to set new goals. Printable January 2022 Calendar with Holidays will organize the list of important days to celebrate holidays in the month of January.

    ReplyDelete
  54. This is very nice blog Historical events are documented in a chronological order that can be determined using dates. You can preserve past and present occurrences in printable calendars for years using date and time, which can be used as proof in the future. Make your own printable calendar 2022 January for the month of January, complete with holidays and events in printable calendar 2021.

    ReplyDelete