Monday, July 5, 2010

SPRibbon.GetCurrent(this.Page).MakeTabAvailable(); not found

If you try to work with contextual tabs, you might want to use server side in order to make these tabs visible.

Please see a link here to a good article about this by Chris O'brien:
https://www.blogger.com/comment.g?blogID=4126985520350746834&postID=8665495763806155424


But, if you just create a new SharePoint solution these methods will not be available to you:
SPRibbon.GetCurrent(this.Page).MakeTabAvailable();
SPRibbon.GetCurrent(this.Page).MakeContextualGroupInitiallyVisible();

The reason is, that these 2 new commands are infact a part of Microsoft.Web.CommandUI DLL, which is available outside of the SharePoint DLL, hence when you only have a reference to SharePoint DLL's you will see the SPRibbon object but some functionality inherited from it's base type will be hidden.

So - add a reference to Microsoft.Web.CommandUI and you'll be good to go!

1 comment:

Vinit Kumar said...

Hi,

Nice Article it saved me some hours.

Thank you so much.