tag:blogger.com,1999:blog-4126985520350746834.post8665495763806155424..comments2024-03-28T07:00:21.554+00:00Comments on Chris O'Brien: Adding ribbon items into existing tabs/groups (ribbon customization part 2)Chris O'Brienhttp://www.blogger.com/profile/10022906552670607366noreply@blogger.comBlogger24125tag:blogger.com,1999:blog-4126985520350746834.post-29933256203508602132013-03-25T18:30:14.835+00:002013-03-25T18:30:14.835+00:00Hi Chris! Thanks for that post!
I would like to k...Hi Chris! Thanks for that post! <br />I would like to know, what can I do if I want to show my custom contextual group and tabs, when the user select a file in a document library? <br /><br />Rodolfo Perez Ghttps://www.blogger.com/profile/15706255810415393948noreply@blogger.comtag:blogger.com,1999:blog-4126985520350746834.post-2010216092809193232011-10-20T11:27:12.526+01:002011-10-20T11:27:12.526+01:00@Paul,
Sure, happy to take a look. Suggest leavin...@Paul,<br /><br />Sure, happy to take a look. Suggest leaving another comment with your e-mail address and I'll get in touch.<br /><br />Thanks,<br /><br />Chris.Chris O'Brienhttps://www.blogger.com/profile/10022906552670607366noreply@blogger.comtag:blogger.com,1999:blog-4126985520350746834.post-26441741326780038722011-10-19T22:07:39.425+01:002011-10-19T22:07:39.425+01:00Great article. It really helped me move forward o...Great article. It really helped me move forward on customizing the SharePoint ribbon. I am having an issue with controls showing up in my custom group and I was wondering if you could help me out.<br /><br />I have added a new group under the EditingTools.Insert contextual tab that shows when you edit a page. My group title shows just fine. I have a section defined under my group, in the XML, but the controls will not show up. <br /><br />I tried posting the XML from my Elements file but it wouldn't let me. If it would help to look at it please give me your email and I will send it to you.<br /><br />Thank you in advance.<br />PaulPaul Gormanhttps://www.blogger.com/profile/17902858465358075454noreply@blogger.comtag:blogger.com,1999:blog-4126985520350746834.post-43116175122251384532011-05-10T15:23:18.314+01:002011-05-10T15:23:18.314+01:00@Darrell,
My suspicion is that there's a typo...@Darrell,<br /><br />My suspicion is that there's a typo somewhere in your code. If you can't post the code as a comment here, suggest leaving another comment with your e-mail address (which I won't publish to the blog). I'll then get in touch with you via e-mail to see if we can work it out.<br /><br />HTH,<br /><br />Chris.Chris O'Brienhttps://www.blogger.com/profile/10022906552670607366noreply@blogger.comtag:blogger.com,1999:blog-4126985520350746834.post-15435673556038873882011-05-10T09:42:13.988+01:002011-05-10T09:42:13.988+01:00Good walkthrough but I am having a problem when I ...Good walkthrough but I am having a problem when I try to add a button to the controls. I actually get the same error if I have any groups in the section or not. The wrror is:<br />Sys.ArgumentException: Cannot deserialize. The data does not correspond to valid JSON.<br />Parameter name: data<br />It won't let me post my code here sorry.Darrellhttps://www.blogger.com/profile/05435958283856276403noreply@blogger.comtag:blogger.com,1999:blog-4126985520350746834.post-50408576388595150922011-01-05T22:38:24.493+00:002011-01-05T22:38:24.493+00:00@Doug,
That's a good question - ribbon develo...@Doug,<br /><br />That's a good question - ribbon development can be pernickity. Here's the things I do once I've made a change in the iterative dev process:<br /><br />- Redeploy the solution using VS2010, ensuring the Feature is being reactivated<br />- Ensure an app pool recycle happens (usually taken care of by the above, depending on your VS deployment configuration)<br />- Ensure the browser cache is either disabled (both the IE Developer Tools and Firebug for Firefox allow you to do this) or cleared<br /><br />This last one is often the one that folks forget to do.<br /><br />HTH,<br /><br />Chris.Chris O'Brienhttps://www.blogger.com/profile/10022906552670607366noreply@blogger.comtag:blogger.com,1999:blog-4126985520350746834.post-2331453388136123402011-01-05T02:06:55.517+00:002011-01-05T02:06:55.517+00:00Chris,
Great article. I can set up a custom button...Chris,<br />Great article. I can set up a custom button now! However, if I set it up and want to add to it by enhancing the code or changing the icon or group where a button is placed, it doesn't happen. I tried restarting the server and clearing cache, but no help. Can you lay out the steps to take for iterative development of button code? <br /><br />Thanks.Doughttps://www.blogger.com/profile/10647894951358444428noreply@blogger.comtag:blogger.com,1999:blog-4126985520350746834.post-85493738727326250172010-11-15T14:44:20.336+00:002010-11-15T14:44:20.336+00:00@Cris, @Markus,
I am experiencing the exact same P...@Cris, @Markus,<br />I am experiencing the exact same Problem as Markus did. I am working on a usual SP2010 (as it is used in these days). After a lot of problems I can now finally see my Tab (not the contents of it though). - The key here was to use your provided Sequences in ContextualGroup AND Tab (in Tab concat 1). <br />Back to my Problem: When clicking on the ContextualTab it just disappears. Tough NormalizeContextualGroup helps by showing the Tab constantly, it hides the Contextual Part, which I want to preserve...<br /><br />I hope someone can help with this... or can point me in the right direction. I would greatly appreciate any help, thx.ddNilshttps://www.blogger.com/profile/16581552964306019799noreply@blogger.comtag:blogger.com,1999:blog-4126985520350746834.post-23936622878808916742010-09-01T20:02:54.808+01:002010-09-01T20:02:54.808+01:00@Jake,
This could be something to do with minor c...@Jake,<br /><br />This could be something to do with minor changes which MS made between the pre-release version I wrote these samples on and the RTM version. I think you now need to make an extra call (yourself) which previously wasn't necessary - unfortunately I can't remember the name (RefreshRibbon??) and haven't needed to do it on RTM yet.<br /><br />Sorry I can't be more help. Can anyone else chip in?<br /><br />Thanks,<br /><br />Chris.Chris O'Brienhttps://www.blogger.com/profile/10022906552670607366noreply@blogger.comtag:blogger.com,1999:blog-4126985520350746834.post-15318827661211748362010-09-01T19:01:44.722+01:002010-09-01T19:01:44.722+01:00Really informative article.
I did run into one i...Really informative article. <br /><br />I did run into one issue. The remove status buttons never get enabled. I looked through the code and put some alerts. The EnabledScript code does not get fired again after the first evaluation when the page loads. Any idea what I am doing wrong?<br /><br />Jake.JacobUTnoreply@blogger.comtag:blogger.com,1999:blog-4126985520350746834.post-90423834118062546332010-06-13T22:56:25.987+01:002010-06-13T22:56:25.987+01:00@Hornet,
Ah, maybe that's the thing missing f...@Hornet,<br /><br />Ah, maybe that's the thing missing from my sample. Unfortunately I don't have access to the pre-release VM I was using to build these samples, but I'll try to verify ribbon.NormalizeContextualGroup very soon.<br /><br />In the meantime, if someone else finds this is indeed the missing piece, would be great if you leave a comment to confirm.<br /><br />Many thanks,<br /><br />Chris.Chris O'Brienhttps://www.blogger.com/profile/10022906552670607366noreply@blogger.comtag:blogger.com,1999:blog-4126985520350746834.post-20398482683825459492010-06-09T13:46:00.690+01:002010-06-09T13:46:00.690+01:00Hi Chris,
Great article, well written and preci...Hi Chris,<br /><br /> Great article, well written and precise.<br />However I'm experiencing the same problem than Marcus.<br />I'm on the RTM Version of SharePoint.<br />My Contextual Group and my tab is showing correctly and when i click on the tab everything disappear.<br />If i do a ribbon.NormalizeContextualGroup my tab is showing correctly O_o".<br />Kind of strange.Hornethttps://www.blogger.com/profile/15700134444586039024noreply@blogger.comtag:blogger.com,1999:blog-4126985520350746834.post-84252572761113098952010-04-06T15:50:38.738+01:002010-04-06T15:50:38.738+01:00@Markus,
One thing that occurred to me is that I ...@Markus,<br /><br />One thing that occurred to me is that I wonder if we are developing on different versions? If you are on the public beta and I did this work on a later build (99% sure I did), that could account for it.<br /><br />If you can wait until after the SharePoint Evolutions conference I could spend more significant time trying to get to the bottom of it. Until then though, I'm afraid I'm flat out preparing demos for my talk :(<br /><br />Sorry I can't be more helpful at the moment..<br /><br />Chris.Chris O'Brienhttps://www.blogger.com/profile/10022906552670607366noreply@blogger.comtag:blogger.com,1999:blog-4126985520350746834.post-30893080099379300882010-04-06T14:47:51.742+01:002010-04-06T14:47:51.742+01:00@Chris,
I do all my code in the OnPreRender metho...@Chris,<br /><br />I do all my code in the OnPreRender method (of my user control) which is supposed to be called on postback as well, but obviously there is no postback event if I click any ribbon tab. After any tab click, my contextual tab vanishes. I don't get any JavaScript errors. I must be missing something, but what?<br />I could send you my code if you want to take a look at it.<br /><br />Thanks,<br />MarkusUnknownhttps://www.blogger.com/profile/16608476303165002483noreply@blogger.comtag:blogger.com,1999:blog-4126985520350746834.post-91356773615676408132010-03-31T23:50:05.653+01:002010-03-31T23:50:05.653+01:00@Chris, @Markus
I'm seeing a similar issue as ...@Chris, @Markus<br />I'm seeing a similar issue as Markus did.<br /><br />The contextual tab shows up, but no controls within it. (I'm pretty certain the ribbon XML is valid - just a simple test button)<br /><br />Clicking the tab has no effect.<br /><br />@Chris - gr8 articles btw, really helpful in light of sparse doc from MS.<br /><br />Could you post a working sample of getting a global contextual tab to show up using a custom field or application page. (I was able to get contextual tabs to work with web parts and IWebPartPageComponentProvider)? That would be greatly appreciated.nikhttps://www.blogger.com/profile/04036271313020300186noreply@blogger.comtag:blogger.com,1999:blog-4126985520350746834.post-7984254109948967062010-03-29T12:05:23.543+01:002010-03-29T12:05:23.543+01:00@Markus,
I haven't experienced this behaviour...@Markus,<br /><br />I haven't experienced this behaviour so not sure what to suggest - certainly you need to make these calls on every page load though, so if you're doing a postback in between you'd need to ensure this is happening.<br /><br />Otherwise if no postbacks, are you getting any JavaScript errors?<br /><br />Chris.Chris O'Brienhttps://www.blogger.com/profile/10022906552670607366noreply@blogger.comtag:blogger.com,1999:blog-4126985520350746834.post-48723622104138862082010-03-26T16:28:17.123+00:002010-03-26T16:28:17.123+00:00Chris, thanks for the great article!
I tried to s...Chris, thanks for the great article!<br /><br />I tried to show a contextual tab whenever I show my application page. To do so I added a user control to my page which registers and shows (MakeTabAvailable and MakeContextualGroupInitiallyVisible) the contextual tab in its OnPreRender method.<br /><br />I managed to see the contextual tab in the ribbon, but whenever I click this tab to make it current, it vanishes immediately.<br /><br />What am I missing?Unknownhttps://www.blogger.com/profile/16608476303165002483noreply@blogger.comtag:blogger.com,1999:blog-4126985520350746834.post-14432324671305236352010-02-23T10:04:19.747+00:002010-02-23T10:04:19.747+00:00@Hypheroth,
Did you recycle the app pool and clea...@Hypheroth,<br /><br />Did you recycle the app pool and clear the browser cache? I found both of these to be necessary when doing ribbon development.<br /><br />HTH,<br /><br />Chris.Chris O'Brienhttps://www.blogger.com/profile/10022906552670607366noreply@blogger.comtag:blogger.com,1999:blog-4126985520350746834.post-10131665989366172242010-02-22T12:32:41.091+00:002010-02-22T12:32:41.091+00:00Hi, I copied your code for adding a custom group t...Hi, I copied your code for adding a custom group to the site tab, but nothing shows up there after deployment :-(<br />Any ideas?<br /><br />greetings<br />martinUnknownhttps://www.blogger.com/profile/13719284315518460156noreply@blogger.comtag:blogger.com,1999:blog-4126985520350746834.post-36654126900257787912010-02-16T00:56:29.097+00:002010-02-16T00:56:29.097+00:00@Nirav,
It could be that the token replacement do...@Nirav,<br /><br />It could be that the token replacement doesn't happen within the CustomAction framework - I could certainly believe that. <br /><br />I think you'll need to write some JavaScript using SP.ClientContext to get the URL of the list to redirect to. My other article which shows <a href="http://www.sharepointnutsandbolts.com/2010/02/ribbon-customizations-dropdown-controls.html" rel="nofollow">how to use JavaScript page components with the ribbon</a> may help.<br /><br />Good luck,<br /><br />Chris.Chris O'Brienhttps://www.blogger.com/profile/10022906552670607366noreply@blogger.comtag:blogger.com,1999:blog-4126985520350746834.post-45957905322438112722010-02-15T13:56:01.904+00:002010-02-15T13:56:01.904+00:00In the Display form example, i tried
javascript:al...In the Display form example, i tried<br />javascript:alert('{ListId}')<br /><br />expecting to prompt me current list id, and it always prompts 'null'<br /><br />isn't {ListId} and other tokens replaced at runtime ?<br /><br />When same script was added from Sharepoint Designer as custom action (instead as from custom feature) in display form, it worked fine.<br /><br />I guess when we are adding custom actions using feature it's have context as null.<br /><br />Any idea why this happens ?.<br />I just want to redirect to other page using custom action with listid as url param.Unknownhttps://www.blogger.com/profile/03404705070140207846noreply@blogger.comtag:blogger.com,1999:blog-4126985520350746834.post-31618147094576635352010-02-10T05:28:58.823+00:002010-02-10T05:28:58.823+00:00Wow, great work. Im about to start this myself and...Wow, great work. Im about to start this myself and your doco is better than that from MS!Peter Knealehttps://www.blogger.com/profile/15312240407884756181noreply@blogger.comtag:blogger.com,1999:blog-4126985520350746834.post-78896364084217341832010-01-29T01:39:11.450+00:002010-01-29T01:39:11.450+00:00Good question, and I think this could be a fairly ...Good question, and I think this could be a <i>fairly</i> common scenario. There are a few elements to this, and I'm afraid I haven't personally bottomed out all of them yet - but that's my aim during this series.<br /><br />A couple of pointers in the meantime:<br /><br />- the built-in get_webPartIsSelected() function may help you with the click event<br />- if it's enabling/disabling the buttons you wish to do, you may be able to combine the above function with code in the EnabledScript attribute attached to the command for your button. This would allow you to enable the buttons only when your web part is in focus.<br /><br />I haven't found a convenient client-side method to show a ribbon or contextual group yet (i.e. a client-side equivalent to the server-side code in this post), but I'm sure there is one as OOTB contextual groups appear without postbacks. I'll be sure to write it down when I find it!<br /><br />Thanks,<br /><br />Chris.Chris O'Brienhttps://www.blogger.com/profile/10022906552670607366noreply@blogger.comtag:blogger.com,1999:blog-4126985520350746834.post-12638050475510945092010-01-28T01:02:36.287+00:002010-01-28T01:02:36.287+00:00Great article Chris. Can you please explain how y...Great article Chris. Can you please explain how you would go about implementing Javascript that would activate a ribbon and enable/disable certain buttons. For instance, I would like a link in my custom webpart to activate the ribbon. Also, I would like to click anywhere in the webpart and activate the ribbon. One thing I notice is that the OOB webparts have an onclick event on the div, I am guessing that needs to be implemented somehow.Unknownhttps://www.blogger.com/profile/03710471280712203565noreply@blogger.com