Thursday, October 25, 2007

SharePoint Tagging – why ?

SharePoint Tagging – why ? Or – why Bring Web 2.0 to SharePoint ?

The answer seems to be obvious – because it’s better!

For the last years, as the Internet evolved, we have seen some interesting trends – the last one we saw (at least one of them…) was “the rise of the Search”.
With the entrance of Google to the market of search engines, the importance of search solutions has become crucial – even to companies such as Microsoft, that found a sudden competition from an unexpected direction.
Suddenly – everyone can just search for a word or a phrase, and the results are there – quick and easy… this has been true for some time, but not in the organizational market.
It has proven to be too complex to manage an efficient search solution for the organization Intranet… too many data sources, too dynamic usage patterns, to many pieces of information that needs to be managed, sorted, indexed etc.

What did we have before ?
Before the search solution came to the game, we had hierarchical order. Every items was place inside a branch on a tree… one dimension of hierarchy, one “view” of information, and all our items can be sorted and found. Apparently – this solution wasn’t sufficient too… hierarchies need to changed here and there, different sorting and access is sometimes required for different users etc.

And so, what we saw on the internet – was the evolving of “Tagging” solutions .

“Tagging” means that you can add any item, locate it wherever you want, and simply by adding a “tag” to it, you can always locate this item, present and access it.

Well, at first, the tagging process should be the easiest thing to do for a user – and indeed it is: just choose a tag by clicking it from a list, and immediately the item is tagged… much simpler than locating a library of a folder on a document library.

Second – provide the users with the simplest tool to locate the tagged items and view those items – and this is the part of the solution called “Tag Cloud” – tag cloud simply presents a cloud of tags in a simple list, with a variable size per each tag according to its usage rate, so when a user choose a tag in the cloud, immediately all items tagged using the chosen tag are presented… again, this is the most simple way of locating information.

The tagging of items and the sorting of tagged items is currently the most convenient way of managing information and knowledge… more than this – as the “free” space of the internet has proven, users prefer this option – both when updating and when searching for information on blogs and WIKI sites.
So why not just provide them with this solution also for their SharePoint ?
Well – there is one by now…
SharePoint Tagging feature solution by KWizCom Corporation.

Tuesday, October 16, 2007

Run code to make changes to all sites in a site collection - code sample

I can’t remember the number of times I had to make the slightest change on all site on the same site collection.
One more loop, one more recursive call… you know…
What am I talking about?
Ever needed to:
· Change a site’s title for all sites?
· Change the email for request access to all sites?
· Cancel request access to all sites?
· Change theme on X number of sites?
· Delete a list from all sites, add another list to all sites, and so on and so forth…
Well, all these needs have one thing in common – they can be easily done using code that iterates through all sites in a site collection.
Writing the long, repeating code that performs this iteration can be very time consuming and redundant.
Here is a code sample that will allow you to run any code you wish on all sites in a collection simple by handling the action you want on one site only. No need to iterate all sites and worry about recursive methods any more.
Simply add this code to you utilities / class code:
#region actions for all webs
delegate void RunForAllWebsAction(SPWeb web);
static void RunForAllWebs(RunForAllWebsAction action)
string rootUrl = GetAppConfigValue("RootWebUrl");
SPSite site = new SPSite(rootUrl);
SPWeb rootWeb = site.OpenWeb();
RunForAllWebs(rootWeb, action);
catch (Exception ex)
Console.WriteLine("** Error: " + ex.ToString());
static void RunForAllWebs(SPWeb current, RunForAllWebsAction action)
Console.WriteLine("* Starting action on " + current.Url);
Console.WriteLine("* Done.");

foreach (SPWeb sub in current.Webs)
RunForAllWebs(sub, action);

Now, all you need to do is create a function of this delegate:
void RunForAllWebsAction(SPWeb web);
For example to add “class number: ” to each site on the classes site collection, create this delegate only:
void ChangeTitle(SPWeb web)
web.Title = "class number: " + web.Title;

And you are done.
(Note that I have only added 2 lines of code to make the change I wanted…)

To make a call to run ChangeTitle on all webs call this:

Well, hope this helps the developers in you,
Shai Ben Shooshan.