Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I'd like to add some custom actions for the pages on our site. These pages all have use the Page or Welcome Page Content Type.

Thanks.

share|improve this question
add comment

2 Answers

To assign ribbon to all pages with specified content type, you can use RegistrationType="ContentType" and set RegistrationId to the content type Id.

For example:

<CustomAction 
   Id="AddRibbonForContentType" 
   Location="CommandUI.Ribbon"
   RegistrationType="ContentType" 
   RegistrationId="0x01080100E7218A6B458E40A49EF635CD​4E1228FF">
     <!-- Your ribbon definition here -->
</CustomAction>

Caution: Your content type id must be uppercase!

Read about CustomAction Element on MSDN for details.

Also it may be useful for you to read about Base Content Type Hierarchy. For example, according to that document, you can use "0x01010901" value to associate your ribbon customizations with all the web part pages.

share|improve this answer
    
Thanks. I'll take a look at your resources to see which Content Type I need to use. Looking back on it, I should have worded this better. I was on the right track with the RegistrationType but must have not been getting the right ID. –  Don McKenzie May 11 '11 at 1:39
    
I am using the same approach but bot being able to add the Custom Actions to one of the Pages in the page library? I have made sure that RegistrationId is ID of Page Content Type and Type is ContentType. All the cases are upper also. –  Falak Mahmood May 10 '12 at 14:53
    
@FalakMahmood, the only thing I can think of is to try clearing browser cache, because browser occasionally caches the ribbon. –  Andrey Markeev May 10 '12 at 17:07
    
@AndreyMarkeev Every time I reload the page, I delete the page cache using the IE Developer tools. I can see the other changes (that I do to the Ribbon) though. Here is the code that I am using to replace Upload Button: pastebin.com/ZvZTjnkY –  Falak Mahmood May 10 '12 at 17:24
    
@FalakMahmood, not the cache then. Are you sure the Content Type ID (CTID) is correct? It's unexpectedly enormously long... Consider trying some other CTIDs, maybe some standard CTIDs from Base ContentType Hierarchy (the link is in the answer above). If it will work, then the problem is with CTID. –  Andrey Markeev May 10 '12 at 17:53
add comment

You can also check my blog post An in depth look at the ribbon control to get more information on how to customize the ribbon and add Silverlight or regular controls to it.

share|improve this answer
    
I'll definitely check that. Thanks. –  Don McKenzie May 11 '11 at 1:40
    
Great blog post @JohnnyT –  Don McKenzie May 11 '11 at 1:52
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.