Search code examples
visual-studio-2010sharepoint-2010ribbon-control

Microsoft.SharePoint.WebControls.SPRibbon not Working In Sharepoint SandBox Solution?


I wanna create Contextual Tab using Webpart In Sandbox Solution..that time I am getting Error as below When i am added Custom-Webpart :

Web Part Error: Unhandled exception was thrown by the sandboxed code wrapper's Execute method in the partial trust app domain: An unexpected error has occurred.

In My Webpart's Code

Microsoft.SharePoint.WebControls.SPRibbon.GetCurrent(this.Page).MakeTabAvailable("MyProject.Ribbon.HelloTab"); 

Is there another way to Solution To create Custom Ribbon Tab?


Solution

  • Altering the ribbon is not permitted from within the sandbox. You have to options available to you.

    1. Make your solution a farm solution (thereby giving it the necessary permissions)
    2. Use a sandbox proxy the perform the steps on the ribbon (see MSDN)