SharePoint [ribbon series]-07. Replace the specified control in ribbon (custom tab for Users)

Source: Internet
Author: User
Tags visual studio 2010

After adding and deleting ribbon, let's see how to change (replace) a control in ribbon. Here, we will continue with the previous project and prepare to replace the button in the example with another Custom button.

The procedure is as follows:
1. Use the SharePoint project created earlier
Add a new blank element in this project, as shown in figure

 

Ii. define the content of this element to implement the replacement function
To open the elements. xml file under replaceribbonbutton, the content is as follows:

<? XML version = "1.0" encoding = "UTF-8"?>
<Elements xmlns = "http://schemas.microsoft.com/sharepoint/">
<Customaction id = "ribbon. customtabexample. cutomimggroup. replacementbutton"
Location = "commandui. Ribbon"
Registrationid = "101"
Registrationtype = "list"
Title = "replace a ribbon button">
<Commanduiextension>
<Commanduidefinitions>
<Commanduidefinition
Location = "ribbon. customtabexample. cutomimggroup. customimggroupgoodbye">
<Button
Id = "ribbon. customtabexample. cutomimggroup. replacedbutton"
Command = "customtabexample. replacementbuttoncommand"
Labeltext = "replace, IMG button world"
Description = "replaced, IMG button world! "
Templatealias = "cust6"
Sequence = "35"/>
</Commanduidefinition>
</Commanduidefinitions>
<Commanduihandlers>
<Commanduihandler
Command = "customtabexample. replacementbuttoncommand"
Commandaction = "javascript: Alert ('this button has been replaced. ');"/>
</Commanduihandlers>
</Commanduiextension>
</Customaction>
</Elements>

In this example, we confirm that the button to be replaced is at ribbon. customtabexample. cutomimggroup. customimggroupgoodbye (Format: [ribbon]. [Tab]. [name of the target group]. [name of the target control]), so here, location is: Location = "ribbon. customtabexample. cutomimggroup. customimggroupgoodbye"

 

3. Deploy custom group items
Press F5. The SharePoint development tool in Visual Studio 2010 will automatically build and deploy functions.
Go to the document library of the website or sub-website. View the result as shown in

 


Reprinted: http://www.cnblogs.com/wsdj-ITtech/archive/2012/03/28/2280561.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.