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:

Wednesday, 3 February 2010

Remove button from the Ribbon in SharePoint 2010

In SharePoint 2007, I have quite a few requests from different client to remove button from the document list view, such as the “Edit in Datasheet” and “Open with Windows Explorer” button. I was able to solve the problem by writing a Javascript to hide the button.

Ribbon is introduced in SharePoint 2010. We can easily make customization it by using the Feature Infrastructure. For example, we can create a new button, delete an existing button, as well as replacing an existing button. Hence I can easily get around with the problem that I had in SharePoint 2007.

In order to hide a button, say the “Open with Explorer”, we will need to create a feature. We start by creating a new folder called “DisableRibbonButton”. Create a new file called “feature.xml” in the new folder and insert the following XML into the file

<?xml version="1.0" encoding="utf-8" ?>
<Feature Id="33057CD9-6D14-45c9-83ED-5E1FE066AC92"
    <ElementManifest Location="Manifest.xml" />

Then create another file called “Manifest.xml” and insert the following XML:

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="">
          Location="Ribbon.Library.Actions.OpenWithExplorer" />

The above XML is to remove the “Open with Explorer” button from the Ribbon for all list with type ID 101, hence all the Document Library type. The location “Ribbon.Library.Actions.OpenWithExplorer” is the ID that is registered in the default Ribbon button XML, which can be found in C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\GLOBAL\XML\CMDUI.XML”

Now we will execute the following Cmdlet using the “SharePoint 2010 Management Shell” to install and active the feature:

Install-SPFeature DisableRibbonButton

Enable-SPFeature DisableRibbonButton –url http://<servername>

After that, go to any document library in your site, click the “Library” tab at the top and you should see the “Open with Explorer” button is now disappeared from the Ribbon.

Friday, 8 January 2010

Notes on Installing SharePoint 2010 Beta 2 on Windows 7 Ultimate

I have just bought a new Sony VAIO laptop for SharePoint 2010 development. It has Windows 7 Ultimate on it and obviously it is 64 bit. Even though there were some problems with the SharePoint 2010 Beta 2 installation, but fortunately I am able to get SharePoint 2010 Beta 2 running on my laptop now without any problem.

I am going to list out the installation steps in this post, as there are lots of article around about the installation steps already. Instead I will list out the problem that I had and how I got around them.

I followed the MSDN article “Setting Up the Development Environment for SharePoint Server” to prepare the installation and most of the things work fine.

For your information, here are the detail of my development environment:

  • Windows 7 Ultimate – 64 bit, with 6GB RAM
  • SQL Server 2008 Standard Edison – with SP1 and latest cumulative updates
  • SharePoint 2010 Beta 2
  • Visual Studio 2010 Ultimate Beta 2
  • Office 2010 Beta
  • No Active Directory

Here are the problems that I had when I setup my SharePoint 2010 development environment.

1. SQL 2008 Install Error: Invoke or BeginInvoke cannot be called on a control

When I run the SQL Server 2008 installation wizard, I got the error message “Invoke or BeginInvoke cannot be called on a control”. After a bit of research, I found the solution mentioned in this post works. All you need to do is minimize all other windows when the installer is running, and make sure the SQL 2008 installer windows is always active by clicking the installer dialog.

Well, this is a weird problem…

2.) Cannot Create New Web Application and Running the Configuration Wizard in Central Admin

This one is easy, just turn off User Access Control and you will be fine.

3.) Visual Studio 2010 Install Error: VC 10.0 Runtime (x86)

I was trying to install Visual Studio 2010 Beta 2 using the ISO file that I downloaded from MSDN. However I was getting an error when the installer try to install the “VC 10.0 Runtime (x86)” component.

After Google for a while, I found this post suggesting using the web installer will fix the problem. I have tried this and it works fine for me.