Thursday, 28 October 2010

Disable MySite and Tagging in SharePoint 2010

SharePoint 2010 provides some cool social features like social tag, note board, and ratings which nicely integrated with MySite. However there might be chance that you don’t want to roll out these features, due to various reasons like change management, training, and governance.

You can disable these features in your server farm and enable them when you are ready. Here are the instructions to disable the features.

  1. Logon to Central Administration web site, go to the Application Management section, and click Manage service applications.
  2. Click the user profile service application item in your farm (by default, it is “User Profile Service Application”)
  3. Click “Manage User Permissions” under People.
  4. In the “Permissions for User Profile Service Application” pop up, select a user group, e.g. All authenticated Users.
  5. Uncheck the “Permissions” item, base on what you want to disable. For your information
    • Use Personal Features – My Links, My Colleagues, Personalization.
    • Create Personal Site – My Site
    • Use Social Features – Tagging, Note Board, and Ratings
  6. Click OK to save the settings.


Please note, unselect Social Features does not remove the “Tags and Notes” group from the ribbon. It will still show up on the page but it will grey out.


To hide the “Tags and Notes” from your site, there’s actually a farm feature that you need to disable. To disable this feature:

  1. Logon to Central Administration web site, go to the System Settings section, and click Manage farm features.
  2. There is a feature called “Social Tags and Note Board Ribbon Controls”. Deactivate it to hide the “Tags and Notes” group from the ribbon.
  3. Now go to your site and the “Tags and Notes” should be removed from the Ribbon.


Tuesday, 26 October 2010

Creating Term Set in SharePoint 2010 Programmatically

Managed Metadata is a very nice feature introduced in SharePoint 2010. It allows you to define terms in a hierarchical collection centrally, and create a managed metadata field that is reference a term sets.

By using the Term Store Management Tool found in Managed Metadata Service, you can create a term set either manually, or by importing a CSV file. You can also create a term set programmatically, either by a feature receiver or a console application. You may ask “Why do I want to provision a term set programmatically?”. Well, by creating the term set programmatically, you are able to define a fixed ID/GUID for you term set or term, and this becomes handy if you want to provision a managed metadata field in a feature (Angus has created an excellent article on how to do this).

First, you will need to add a reference to “Microsoft.SharePoint.Taxonomy.dll”, which should not be too hard to find in Visual Studio 2010. Next, an obviously, you will need to put the following line:

Code Snippet
  1. using Microsoft.SharePoint.Taxonomy;

And here is the code:

Code Snippet
  1. string siteUrl = "http://sharepoint2010";
  2. Guid newTermSetId = new Guid("{60F494A0-C31C-4D7C-9C9B-D8AF3191F3D5}");
  3. Guid newTermId = new Guid("{E39C3477-500E-4EB0-9891-0785F840DF53}");
  4. using (SPSite site = new SPSite(siteUrl))
  5. {
  6. TaxonomySession session = new TaxonomySession(site);
  7. if (session.TermStores.Count > 0)
  8. {
  9. // Get a reference to the store
  10. TermStore store = session.TermStores["Managed Metadata Service"];
  11. // Create a group
  12. Group group = store.CreateGroup("SharePointEgg.Test");
  13. // Create a term set in the group, with a pre-defined ID
  14. TermSet termSet = group.CreateTermSet("Term Set Test", newTermSetId, 1033);
  15. // Create a term in the term set in the newly created term set, with a pre-defined ID
  16. Term term = termSet.CreateTerm("Term 01", 1033, newTermId);
  17. // Save everything by calling CommitAll
  18. store.CommitAll();
  19. }
  20. }

And here is the end result: