Any way to have MOSS list the time range of an event in a Calendar View of a list instead of just the start time?
This question of the day comes from iamspartacus in Stump the Panel.
Any way to have MOSS list the time range of an event in a Calendar View of a list instead of just the start time? Need to create an after hours schedule that shows start and end times but don’t really want to buy Calendar Plus if I don’t have to.
My solution: Create a calculated column to display as ‘Month View Title’:
=[Title]&" : "&TEXT([Start Time],"h:mm")&"-"&TEXT([End Time],"h:mm")</pre> Or, if you prefer 12-hour time format: <pre lang="javascript">=[Title]&" : "&TEXT([Start Time],"h:mm AM/PM")&"-"&TEXT([End Time],"h:mm AM/PM")

Next, use a little jQuery/JavaScript to remove the default Start Time:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js" type="text/javascript"></script> <script type="text/javascript"> $(function() { $("td.ms-cal-monthitem> a") .find("nobr").remove() .end() .find("br").remove(); }); </script>
Okay. I’ll ask the dumb question. To get the “little jQuery/JavaScript” in there, you have to find and edit the event file, right? Which also requires that you have access TO those files?
The adding of the calculated column can be done with OOB but not the “little jQuery/JavaScript”. Right?
@Lynda,
I don’t even know what an event file is. Copy and paste the exact code into a CEWP and it will work–that’s it, no changing system files or needing access above site contributor.
Here’s a link to a video I did of another solution: http://video.msn.com/video.aspx?vid=cf997972-7b0c-49d8-8fbf-52127d46512d
Paul,
This is great, exactly what I have been looking for. However, when I do this, all that happens is the Start Time is removed from the calendar, the Title remains, and the calculated column doesn’t show.
Is there something I need to do in the jQuery to add that calculated column to the calendar?
Thanks,
Nick
Nevermind, I am an idiot. Just have to change that in the view.
I do have another question though. Is there a way I can make it so this does not apply to all day events?
Well I answered my own question. If you want this to display only for events that aren’t all day, use this equation in the calculated column:
=IF([End Time]-[Start Time]<0.999,Title&” : “&TEXT([Start Time],”h:mm”)&”-”&TEXT([End Time],”h:mm”),Title)
Has to be .999 instead of 1 because sharepoint sets an all day event from 12:00am to 11:59pm.
Hope this helps someone, definitely helped me.
After seeing and trying a lot of these JQuery stuff I finally tried it. The problem I am having is that my site is SSL and it doesn’t like loading query file because of that.
Is there a SSL version or will I have to copy the JS to my server to do it properly?
@Ashu,
For SSL sites, download the file from Google and place it in a document library where everyone can access it. Then change the script tag to have the local SRC path.
See my article: http://www.endusersharepoint.com/?p=980
I talk about a “contingency script” but you can also use that as the default.
Get it in German Sharepoint and with switched order:
=TEXT(Anfangszeit;”hh:mm”)&”-”&TEXT(Endzeit;”hh:mm”)&” : “&Titel
@Nick,
That’s a great tip! I didn’t realize a full-day event was only .999 of a day :)
I too ran into the problem that now I see the event listed in the calendar but no times. I added the calculated field and the CEWP. Could you specify what needed to be changed in the view? Thanks
nm. i took off my blinders so i can see my hands in front of my face.
only problem i have now is that the all day events use the GMT setting so my times show 19:00 – 18:59. i could reset the regional settings at the site level but is there something for just the calendar?
@Dred,
I don’t think you mean GMT, I think you mean military format. If you use the second calc column formula, it will display AM/PM format.
To add the end time field to all Calenders (month view) in your site collection ad once, this msdn article provides another solution.
http://social.msdn.microsoft.com/Forums/en-US/sharepointcustomization/thread/179c74de-525c-4236-83cf-91861e9a7aee/#page:1
I found a small bug in this. If you set the time span from say 11pm to 2am, then the time shows up as 2am – 11pm instead of 11pm to 2am.
@Jason,
That’s not a bug with the formula. It’s not possible to start something at 11pm and end at 2am on the same date. 2am means you’ve moved into the next day.
So, if you look at the form again, SP has reversed the dates you entered assuming you made a mistake. The formula only returns the form’s values.
If you enter the dates and times in the right order, SP will not change your values and the time span will appear as you expected.
Hi,
I’d like to have displayed on the calendar view the Creator (Created By) and another field like Location.
The problem is that is not possible to choose Created By in a calculated column.
Is there a solution for this?
thanks
andrew
@backtrack
I think you have to create a new field that gets filled by an SPD workflow (on create) with the Author’s name. Then you can use it in a column calculation.
@AutoSponge
Thanks a lot for the tip!
I have added an “Update item” action in SPD that fills a “single line of text” column with the CreatedBy of the current item. Then i created a calculated column that can use that and another field.
The only thing is that it writes the creator as “domain\username”, instead the default calendar view Created By shows the nicer readable “surname name”.
have you got maybe another tip? :)
Hmm. I think if your target field is a Person type you can choose to display ID, user name, SIP, etc.
But I’ve also heard of people having problems updating Person columns in SPD.
What data type did you go with?
the target field is “single line of text” type because “Person or Group” type cannot be used in a calculated column.
I need to use a calculated column to combine the name and the location which must both be “single line of text” type.
So in SPD when I choose which value to assign the new field, I select CreatedBy of current item (and selected the proper list)
Use Web services and xpath…
1. path data connection:
https://site/_vti_bin/UserProfileService.asmx?WSDL
2. Web Service
GetUserProfileByName
3. Textbox field
concat(xdXDocument:GetDOM(”GetUserProfileByName”)/dfs:myFields/dfs:dataFields/s0:GetUserProfileByNameResponse/s0:GetUserProfileByNameResult/s0:PropertyData/s0:Values/s0:ValueData/s0:Value[../../../s0:Name = "FirstName"], ” “, xdXDocument:GetDOM(”GetUserProfileByName”)/dfs:myFields/dfs:dataFields/s0:GetUserProfileByNameResponse/s0:GetUserProfileByNameResult/s0:PropertyData/s0:Values/s0:ValueData/s0:Value[../../../s0:Name = "LastName"])
It’ doesn’t work in french. I have a problem syntax of the formula.
Thank’s to replay
I have put in the top guide mentioned to get the start/end date in however it does this but it also prefixes the date with “string;#” which looks horrible, is there anyway to remove this?
Great information.
I was just having issues with the second part. Where is the CEWP located in the calendar page. I just can’t seem to find where to put the code.
Nvm. I actually did a little more reading and realized that I had to add the web part.
Is there anyway to add a CEWP to the default.aspx to add the end time there as well?
@.ivan
You can add a CEWP to the defaut.master. Christohpe has a good article about that approach here: http://pathtosharepoint.wordpress.com/2009/02/15/a-content-editor-web-part-for-every-home/
Just be careful. This will be on EVERY page. Since I didn’t test it on other pages, it may need modification to avoid changing something unintentionally.
Any ideas on what to do with Recurring Events? I cannot get the time to display correctly on these. I’ve also put out a plea for help on Stump the Panel, too!!
Hello all (and hopefully Autosponge)!
The script for removing the default Start Time from a Calendar, that Autosponge provided a year ago, was working great but has since stopped working – the default Start Time is now showing up again in my calendars.
Did something change at the script source?
iamspartacus
@ iamspartacus,
Check to make sure your version of jQuery is still available. This was written a while back, jQuery 1.4 is out now, so you may need to update the link.
I tried the fix for this (that is, updating the link) and it still did not work. I even downloaded the .js file and referenced it internally with no luck. Has anyone gotten this to work recently? (So i can tell if it is something i’m doing wrong or perhaps this function somehow got dropped?)
Thanks for any help anyone can offer!
Tasha
This is a great fix. I do have one issue though. When I have 4 or more events in a day on the Monthly view I lose the “more item(s)” link. The expand all link will show all of the events. The issue is if there is no visual indicator, my endusers will not even think to check. Any ideas?
Thanks,
Tim