Thursday, April 2, 2009

Showing doc icons and new icon in Data View of Document Library

There are a lot of posts out there explaining how to display the icons when displaying a document library in a data view but only one actually worked for me:
http://mdasblog.wordpress.com/2008/09/10/displaying-the-document-type-icon-in-a-dvwp-in-sharepoint/

This post shows how to show the NEW! icon if the document is new:
http://www.thesug.org/blogs/SharePointUnwrapped/Lists/Posts/Post.aspx?List=b15183f0%2D2d65%2D4e24%2D8a34%2Da19a345d6176&ID=6

This post (tip 4) shows how to get the folder icon if the content type is a folder: http://www.sharepointblogs.com/mkruger/archive/2007/06/26/free-sharepoint-dataview-tips.aspx
You don't have to link to the sharepointblog site though for the image. You should have it in /_layouts/1033/images/new.gif.

Wednesday, February 4, 2009

Useless SharePoint fact

I discovered that the calendar date limit within SharePoint is December 31, 8900, significantly later than the Windows calendar limit of December 31, 2099.

So, yeah.. useless fact.

Friday, January 16, 2009

Tools/Features/Solutions/Webparts that I've found very helpful

Document Rating
Limited Access Report
My Alerts
Office File Types
Print List (Part of SharePoint 2007 Features)
Site Information
SP Client Utilities
AD Tools for SharePoint
Quick Access Site Settings (see also my post)
Log File Viewer (for SharePoint Central Administration)
Custom Applications Pages (requires free registration)
SharePoint Site Browser (requires free registration)

A lot more free WSS 3.0/MOSS 2007 products at wssv3faq.mindsharp.com

Quick Access Site Actions

I found an awesome post by Tony Bierman [MVP WSS] that enhances the site actions menu to include callout menus for the options available on the Site Actions page. It is a much quicker way of getting to where I need to. Here is a quick preview:



Thursday, January 15, 2009

Error pages in SharePoint

Note: Because this blog automatically formats any markup, I've added dashes (-) in all elements (<-P->).

It's not very often that a SharePoint admin or developer gets to see the same errors that end users see when using SharePoint. Although I'd imagine that when end users receive errors, it is logged somewhere but I haven't looked to see where that log file is. Instead, I made a simple change to the SharePoint error page requesting the users to send me a copy of the error.

First, in order to get a detailed error message, you need to make two changes to your web.config file, located in C:\Inetpub\wwwroot\wss\VirtualDirectories\80. Find <-SafeMode ... CallStack="false" ...-> and set the CallStack value to "true". Then scroll down to find <-customErrors mode="On"-/> and change the mode to "Off". (taken from Andrew Connell's blog). Now you will get detailed error pages with a stack trace to help you pinpoint where the error happened.

Now back to my custom error page. In the 12 Hive (C:\Program Files\Common Files\Microsoft Shared\web server extensions\12), open TEMPLATE\LAYOUTS\error.aspx. I added the following markup (minus the dashes) in the "PlaceHolderMain" content control right before:

<-p-><-b->Unfortunately an error has occurred. Please copy this error and email it to <-a href="mailto:email@domain.com">email@domain.com<-/A->.<-/b-><-/P->

Now your error pages will look something like this:

Wednesday, January 14, 2009

Filtering Blog Posts - Fixing the Category filter

It seems that when you modify the view of a blog, it loses it's ability to filter by Categories. Unfortunately you have to get your hands dirty a little bit to fix this. It's not a hard fix just can be a little confusing with the CAML queries as they are formatted to html.

Note: because of html formatting, I had to type the <> codes with a space before the semicolon (&gt ;) so you can see it.

First, make a copy of Categories.aspx so you can replace it if something should go wrong.
Then open the Categories.aspx page (Lists > Categories) in your favorite editor. I just use SharePoint designer. View the page in Split view. Then click the Post web part on the page. It probably says something like "There are no posts in this category." This should highlight the code in the code viewer. Within that webpart code, scroll down to find the ListViewXml element. Within that element there is a bunch of html. (I like to copy the html into Notepad, then do a find and replace, changing all the &lt ; and &gt ; to <>. This makes the code much easier to read.) Find the Query element within that html. Now you may need to do a little research into CAML queries as that is what this query is.

Now I wanted to change the query to only show posts that are less than 20 days old. To do that, I modified the query element to look like this:

<Query><OrderBy><FieldRef Name="PublishedDate" Ascending="FALSE"/><FieldRef Name="ID" Ascending="FALSE"/></OrderBy><Where><And><Eq><FieldRef Name="PostCategory"/><Value Type=""><GetVar Scope="Request" Name="Name"/></Value></Eq><Geq><FieldRef Name="PublishedDate"/><Value Type="DateTime"><Today OffsetDays="-20"/></Value></Geq></And></Where></Query>

Now just change the &lt ; and &gt ; back to <> and then replace the query element. This should filter your posts by category and only show those less than 20 days old.

Event Reminders for your Calendars

There are some third party apps out there to accomplish this, but I prefer free and using SharePoint's built-in features (it seems to be more reliable!). This example shows how to set up a reminder for 1 day before the event time, but it follows the same for however early you want your reminder.

1. Add a custom field to the calendar called "Alert - 1 day". Make it a calculated field with the calculation [StartTime]-1. Make sure it is a date type. I also specified date and time so the alert goes out exactly one day before, to the minute.
2. Then add a custom field to the calendar called "Reminder Recipients". Make it a people picker control and choose to show Email addresses and probably allow multiple selections too.
3. Next, open your site in SharePoint designer and create a workflow (New > Workflow) for the calendar. Set the workflow to automatically start when the event is created/changed. I also created a workflow variable called "Recipients" of type string. Then my workflow went like this:

If Alert - 1 day is greater than Today
Pause until Calendar:Alert - 1 day
then Set Variable: Recipients to Calendar:Reminder Recipients
then Email Variable: Recipients

Basically, when creating a new event, the person specifies who they want the reminder to go to. Then once the event is created, the workflow is automatically started. The workflow assumes the event is in the future (The IF statement). Then workflow just pauses until it reaches the date of the "Alert - 1 day" field that should contain the date of exactly 1 day before the event. As soon as that date is reached, the workflow starts up again, gets the recipients that were specified and sends them an email. In the workflow creation, you can customize the content of the email and even include calendar lookup values in the email.