Thursday, October 21, 2010

Fix the issue of empty WssId

While I was busy building an app for multiple tagging in sharepoint, I was stuck with a problem involving the method GetWssIdOfTerm() returning empty values if the term has never been used before in the site.
After a few hours of research I found a blog post that helped me with that problem.
I am not too sure who posted it but it helped me a lot.
I had to do a few modifications to the codes but now it works.

The blogspot is here

Enjoy.

Friday, October 15, 2010

Issue with GetWssIdOfTerm() method in sharepoint

I am sure that most sharepoint developers know about the GetWssIdOfTerm() method.
I recently used that method and for some reason it was always returning a null value.
After hours of struggling and screaming, I noticed that the wssId of a term stays null until it has been used at least once, so until you use your term at least once that method will always return a null value.
If I had known that before it would have saved me quite a few hours of screaming.

Monday, October 4, 2010

Retrieving Taxonomies Progrmatically

I recently made a quick google search on how to retrieve taxonomies programatically, and I could not find anything, so I thought I would blog about how to do it.
Get from it what you can.

SPSite thisSite = SPContext.Current.Site;
TaxonomySession session = new TaxonomySession(thisSite);
foreach (TermStore tStore in session.TermStores)
{
    Console.WriteLine("Term Store:" + tStore.Name);
    foreach (Group tGroup in tStore.Groups)
    {
        Console.WriteLine("Group:" + tGroup.Name);
        foreach (TermSet tSet in tGroup.TermSets)
        {
            Console.WriteLine("Term Set:" + tSet.Name);
            foreach(Term term in tSet.Terms)
            {
                Console.WriteLine("Term:" + term.Name);
            }
        }
    }
}

Or you can use this way

TaxonomySession session = new TaxonomySession(siteCollection);
TermStore termStore = session.TermStores[tagsField.SspId];
TermSet termSet = termStore.GetTermSet(tagsField.TermSetId);
myTerm = termSet.Terms[myTermName];

In this scenario tagsField was a taxonomy field that I am trying to update and myTermName is the term name I am trying to get (let me know if you get confused).

Friday, October 1, 2010

Talk to SharePoint Through Its Web Services

Recently I have found out that sharepoint web service are quite powerful and interesting to use.
For anyone interested in learning more you should read this post by Klaus Salchner.

Wednesday, September 22, 2010

Difference between SPWeb.Groups and SPWeb.SiteGroups

SPWeb has two sharepoint cross-site group collection, SPWeb.Groups and SPWeb.SiteGroups. SPWeb.Groups returns collection of cross-site groups which has some permission on the site. So if you add group from a site without any permission on the site, then this group wont appear in SPWeb.Groups collection, but it will appear in SPWeb.SiteGroups collection.
You can not use SPWeb.Groups.Add method to add new cross-site group, you need to use SPWeb.SiteGroup.Add method for this purpose.

Info from Sridhar

Friday, September 17, 2010

How to make your intranet sharepoint site be live

The easiest way to do make your sharepoint site live would be to use an SLA that will redirect the user to your intranet site when the url you assigned it is hit. (More to come to explain how to achieve this)
For those of you who do not know what an SLA is, follow this link http://blog.sharepoint-recovery.com/2007/09/17/whats-the-service-level-agreement/