SPServices Hello World!

//Hello world. This is a quick script for new users to see if everything is working ok:

<script type=”text/javascript”>
      alert (“js on.”);
                $(document).ready(function() {
                                 alert (‘jQuery on.’);
                                 var thisSite = $().SPServices.SPGetCurrentSite();
                                 alert (‘Hello World!  Your site is : ‘ + thisSite );


Simple way to get a Document Library Aging Report View

This shows a listing of documents that haven’t been modified in the past year. You can modify the folder setting and adjust the number of days you want.

Settings –> Create View –> Standard View


  • Aging


  • Name (linked to title with edit menu)
  • Modified
  • Modified By
  • Created
  • Created By
  • File Size
  • Content Type


  • Modified –> Descending


  • Modified –> Less than or equal to –> “[Today]-365”
  • AND
  • Content Type –> not equal to –> “Folder”


  • Show all items without folders

Now, you can also get fancy, and add the parent folder using SharePoint Designer.

Some SharePoint JavaScript Libraries


Boris Gomiunik just released some helpful JavaScript Libraries

Fun with MOSS 2007 Surveys

We have a survey that has branching and/or pagination.  MOSS 2007 places the next question on the second page and gives the user an option to save response so that they can come back to it later. If we have a survey that has many branching questions, and/or pages, then SharePoint puts pages between the questions, with a ‘save’ button, ‘cancel’ button and a ‘next’ button.

When a user saves the response, you will see that number of responses increase. If you have fifty responders and some of them saved the response, but did not complete the survey, the total number of responses is equal to fifty, but when you view all responses, you will only see the completed survey responses.

Even if you have Full Control (or site collection administrator), nobody can see those responses except the person who has saved the response.

Surveys have a ‘hidden’ column named “Completed” – in “All Responses” view, you will find only those responses whose “completed” field value is “yes”.  If a person has saved response, that user will see the status as “no” in “Completed” column, but we cannot see those responses, only the user can see that.

This is a known issue in MOSS 2007.  I do not know if SharePoint 2010 handles it differently, let me know if you want me to find out for you, or if you know, please tell me!

This issue affects the “All Responses” view and the “Overview” view.  It is not possible to create a new view for any survey list that includes the “completed” = “no” answers…

We can either remove the pagination/branching or we can go with what we have, or use some JavaScript and a CEWP to have it remove the “Save” button, so that users cannot save without completing the entire survey.


More fun:

  1. Go into the Survey Settings page, and get the list ID from the URL.
  2. Copy the list ID into your clipboard.
  3. Go into the /_layouts/viewlsts.aspx page, and select any list that is not a survey list.
  4. Click the ‘Create View’ page for that list.
  5. Have a look at the URL – delete the list ID from the URL and add the list ID for the survey (should be in your clipboard), press ENTER.
  6. Create a new view for your survey list! – make sure you DO NOT select “default” as the style or it will just look like the “overview” page.
  7. Just for kicks and giggles, group the view by “completed” and you will see a nice little behavior on your new view page.

Getting Started In Development

Just a quick note to my future self:



That is all.

Keywords and Best Bets

Keywords and Best Bets are an interesting feature of MOSS 2007.

If you don’t know how it works, here is a little explanation:

“Keyword Best Bets are relevant items that you can choose for a subject. You add keyword Best Bets to a keyword to mark the items that are most relevant for that keyword. When a portal user types a keyword into the search box, all keyword Best Bets for that keyword are displayed prominently in search results.”

First of all, we like to categorize our best bets, so that users aren’t clicking “mystery meat navigation“. Here are our categories:

  • Application (links to a Web Application such as time management, project management, etc)
  • Blog (links to a blog)
  • Discuss (links to adiscussion forum)
  • Doc Folder (links to adocument folder)
  • Document (links directly to a single document)
  • Download (links to a download-able a file, like a zip file)
  • Email (links to a mailto: link)
  • Form (links to a web form)
  • Item (links to a single item in a list)
  • List (links to the default view of a list)
  • Search (links to a  ‘better’ search term)
  • Site (links to an internal web site)
  • Survey (links to a MOSS Survey)
  • Video (links to a video file)
  • Web (links to an external web site)
  • Wiki (links to a Wiki site)

So, for example, our Best Bet URL would be http://www.fedex.com/ and the Title would be “Web: FedEx”

That is just a little tip for “Best Practice.”

Limitations of each SSP instance:

  • Only Site Collection Administrators can manage Best Bets (this sucks!).  As a Site Collection Administrator, I wash my hands of maintaining any site content.  This should hold true for Best Bets too, but I can see why, as this is at the SSP level, a SCA must get involved, oh well.
  • Any keyword’s description field is at most 500 characters.The description field is only 500 characters, and it is a rich-text field, which means it populates it’s own HTML, and there is no telling how many characters of HTML-goo that rich text editor is placing there.  (side note: we call Word HTML “Word Goo” because there is so much of it in a document source, and it is very hard to get rid of).
  • There are only 15 Best Bet URLs that can be entered into the SSP.  I am not sure why this hard limit exists, but it does.
  • Only one instance of any URL can exist in the SSP (see “quirks” below for a hack).  Some of our business practice rules come into play here, such as: Don’t link to a “*.aspx” page – only link to the site level, leave out “pages/*.aspx”, so that the MOSS server will direct the user to the correct welcome page.  Link to the list, not the view, in the same way (don’t link to “AllItems.aspx”).
  • Only one instance of a keyword or synonym can exist.  If we have a term that has multiple meanings, then you have to include all of the Best Bet URLs to that term.

Some Quirks:

I found a hack to get around this – if you use HTTPS (and who isn’t?), you can enter the URL as “HTTPS” protocol, and then enter it again with a different title, and point it to “HTTP” – MOSS will automatically change the protocol to HTTPS, even in the best-bet editor!  But if you look in the database, it is stored as an “HTTP” URL!  If you need to enter the same URL and the same title, then you can just select it in the editor using the “select existing best bet”.

Sometimes, and I haven’t been able to reproduce this since SP2, but you can get a duplicate URL into the database somehow, using the Best Bet edit screen.  I think it has to do with assigning a best bet URL to multiple keywords, deleting it from the ‘first’ keyword, and then re-entering it again manually, which confuses MOSS.  Anyway, you might get an error message which prevents you from editing or removing that URL from the keyword.  You can delete the keyword and start over to resolve it, or you can edit the db entry for that keyword (WARNING: SharePoint … Database … DO NOT … Yadda, Yadda, Yadda, I know) and point to another URL instead, then open up the edit screen again and you will get no error.  I haven’t had any problems editing any SSP database tables data directly, but YMMV.

We don’t want to build custom application using the SharePoint object model, because we don’t have access to the MOSS server directly, so we got read only access to the database that contains the SSP datastore.  I have build a shiny little Windows Forms application that looks into the ssp database, READ ONLY (WARNING: SharePoint … Database … DO NOT … Yadda, Yadda, Yadda, I know).

MOSS doesn’t really give us a very good interface for managing Keywords and Best Bets where the URL is 404’d!  I have about 1200 or so URLs to manage through my keywords management tool (Top-Level-Site: Site Actions –> Site Settings –> Modify All Site Settings –> Search Keywords), so I created my own tool that goes through all 1200 or so URLs and looks for 404 errors, Business mis-categorizations, and other things.  I probably won’t release to codeplex, as I an just a beginner with .NET, and it has a lot of Business Process hard-coded in it.

I’ve managed to find the tables and relationships, etc etc, and build this little application that lists all of the Best Bet Titles, URLs, what the parent keyword is (and working on a list of synonyms to add to a custom report that can be spit out), who the owner is, expiry date, description, and review date. The custom app runs the URL and title through some checking (we format our Best Bet URL titles with a category, then a title, so that we can see what the link goes to). It also checks the URL and if the application gets a 404, well we know to contact the owner and get a new best bet set up.

Here is the Query that will get a good generic view of the data:

SELECT DISTINCT MSSSpecialTerms.Term, MSSSpecialTerms.Definition, MSSSpecialTerms.Contact, MSSSpecialTerms.ReviewDate, MSSSpecialTerms.StartDate, MSSSpecialTerms.EndDate, MSSBestBets.Title AS BestBetTitle, MSSBestBets.Title AS BestBetDescription, MSSBestBets.Url AS BestBetURL, MSSBestBetsLink.[Order] AS BestBetSortOrder, (SELECT Term + ‘; ‘ FROM MSSSynonyms WHERE MSSSynonyms.SpecialTermID = MSSSpecialTerms.SpecialTermID ORDER BY Term FOR XML PATH(”) ) AS OtherSynonyms
FROM MSSBestBets INNER JOIN MSSBestBetsLink ON MSSBestBets.BestBetID = MSSBestBetsLink.BestBetID INNER JOIN MSSSpecialTerms ON MSSBestBetsLink.SpecialTermID = MSSSpecialTerms.SpecialTermID INNER JOIN MSSSynonyms ON MSSSpecialTerms.SpecialTermID = MSSSynonyms.SpecialTermID
ORDER BY MSSSpecialTerms.Term, BestBetSortOrder