{"id":584,"date":"2012-06-04T15:29:49","date_gmt":"2012-06-04T14:29:49","guid":{"rendered":"http:\/\/blog.repsaj.nl\/?p=584"},"modified":"2012-06-04T15:29:49","modified_gmt":"2012-06-04T14:29:49","slug":"sp2010-delegate-control-for-globalsitelink3-not-working-showing","status":"publish","type":"post","link":"http:\/\/blog.repsaj.nl\/index.php\/2012\/06\/sp2010-delegate-control-for-globalsitelink3-not-working-showing\/","title":{"rendered":"SP2010: Delegate control for GlobalSiteLink3 not working \/ showing"},"content":{"rendered":"<p>I spent quite some time today on a question I was asked. In an existing solution, we added a custom action (button) to the standard menu (the dropdown menu on your account name in the right upper corner of a site). This button was a &#8220;Add site to favorites&#8221; custom solution. The request was: can we move that button to the same place the default &#8220;I Like it&#8221; and &#8220;Tags &amp; Notes&#8221; buttons are? I didn&#8217;t think that this would be such a problem. But I was wrong due to my good friend: the Sandbox. <!--more--><\/p>\n<p>There&#8217;s two important things to know. First of all, the default &#8220;I Like it&#8221; and &#8220;Tags &amp; Notes&#8221; buttons are <strong>not<\/strong> in the ribbon, although they appear to be. That&#8217;s because the area shown by default, the &#8220;Browse&#8221; tab, is not an actual ribbon tab. I don&#8217;t exactly know why this choice was made, probably because you might want to disable the ribbon without losing this area. The area is defined in you master page instead.<\/p>\n<p>Ok so where do those buttons then come from? We&#8217;ll they&#8217;re in a feature called <strong>&#8216;SocialRibbonControl&#8217;<\/strong>. Inspecting the element files learns us that the buttons are defined twice: in SocialDelegateControl.xml and SocialRibbonControl.xml. The ribbon buttons are shown in a document library, they&#8217;re not of interest at this point. The delegate controls tell us that we&#8217;re dealing with delegates here.<\/p>\n<p>The delegate control being used is <strong>GlobalSiteLink3<\/strong>. So we now know what to do, right? Create a new feature, implement a custom control and use a Control node to overwrite the delegate with our control. Easy peasy. Sure. When you&#8217;ve got farm access.<\/p>\n<p>For some reason, Microsoft decided to mark the DelegateControl definition for GlobalSiteLink3 with <em>Scope=&#8221;Farm&#8221;<\/em>. So the only features allowed to overwrite it are <strong>farm scoped features<\/strong>. And there&#8217;s the second important thing to know: farm scoped features are not allowed in a sandboxed environment. Why scope the delegate\u00a0Microsoft, WHY!? I really don&#8217;t understand why you would limit us like that. What&#8217;s the security risk here? By the way, this scope is only applied to GlobalSitelink2 and GlobalSiteLink3.<\/p>\n<p>I checked, hoping that they might have changed this in Office 365, but unfortunately they did not. I&#8217;ll open up a ticket about that, but untill it&#8217;s fixed this means you&#8217;ve got two options:<\/p>\n<ol>\n<li>Deploy in combination with a custom masterpage in which you remove the Scope=&#8221;Farm&#8221; attribute. Then you can deploy your site scoped feature and overwrite the delegate.<\/li>\n<li>Deploy as a farm scoped feature, but as stated that will only work for non-sandboxed solutions.<\/li>\n<\/ol>\n<p>But both aren&#8217;t good options for me at this time. Perhaps Microsoft will come up with a solution. Changing the v4\u00a0masterpage definition for Office 365 would be the easiest, but the chance of that happening soon is&#8230; well&#8230; not that big.<\/p>\n<p>Update: here&#8217;s the O365 community\u00a0post; <a href=\"http:\/\/community.office365.com\/en-us\/f\/153\/p\/55979\/201597.aspx#201597\">http:\/\/community.office365.com\/en-us\/f\/153\/p\/55979\/201597.aspx#201597<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I spent quite some time today on a question I was asked. In an existing solution, we added a custom action (button) to the standard menu (the dropdown menu on your account name in the right upper corner of a site). This button was a &#8220;Add site to favorites&#8221; custom solution. The request was: can<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","jetpack_publicize_message":"","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false}}},"categories":[34],"tags":[60,58,7,47,59],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p3KFR1-9q","_links":{"self":[{"href":"http:\/\/blog.repsaj.nl\/index.php\/wp-json\/wp\/v2\/posts\/584"}],"collection":[{"href":"http:\/\/blog.repsaj.nl\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/blog.repsaj.nl\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/blog.repsaj.nl\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/blog.repsaj.nl\/index.php\/wp-json\/wp\/v2\/comments?post=584"}],"version-history":[{"count":0,"href":"http:\/\/blog.repsaj.nl\/index.php\/wp-json\/wp\/v2\/posts\/584\/revisions"}],"wp:attachment":[{"href":"http:\/\/blog.repsaj.nl\/index.php\/wp-json\/wp\/v2\/media?parent=584"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/blog.repsaj.nl\/index.php\/wp-json\/wp\/v2\/categories?post=584"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/blog.repsaj.nl\/index.php\/wp-json\/wp\/v2\/tags?post=584"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}