Preface: In Sharepoint, a common operation is to add ourCustom BCD menuNext, we will briefly introduce how to add a custom BCD menu. IntroductionTwo familiar methods,XMLMethod, the other is through Js.
Environment:SharePoint 2010 ServerIn theory, both 2007 and 2013 are supported, but I didn't perform the test.
Method 1: XML (there are many images, but I am not a Paster)
1. Create an empty project, such.
2. Select the solution of the field, and select the test address you need for the test address.
3. on features, right-clickAdd new featureFor our XML file.
4. Modify the feature name, description, and scope.Feature attributesTo facilitate future operations.
5. Add an empty element to add our XML.
6. Add an XML file. Note that the ID is guid. You are advised to generate a new one.
7,XML file format, As shown in the following figure.
<? XML version = "1.0" encoding = "UTF-8"?> <Elements xmlns = "http://schemas.microsoft.com/sharepoint/"> <Customaction id = "{16d0fc49-3039-40ea-a887-d05a7ff9bb21 }" Registrationid = "101" Registrationtype = "list" Location ="Editcontrolblock" Title = "test BCD menu" Groupid ="Actionsmenu" Sequence = "100" imageurl = "/_ layouts/images/doc16.gif"> <Urlaction url = "{siteurl}/_ layouts/viewlsts. aspx"/> </Customaction> </Elements> |
8. Add the XML item to feature. After the XML item is addedAutomatically addIn feature, I want to talk about how feature activates the XML function.
9,DeploymentWe have written a solution to the test site, and VS in SharePoint 2010 willAutomatic activationThis solution.
10. GoWebsite FunctionsSee the feature we have deployed.Activated. Because we are in the Web scope, it is in the website function; you can try the site range, you need to go to the website set function to see.
11. Let's see what we add to the BCD menuEffect.
Method 2: Use JS scripts.
1. Open the page for expanding the BCD menu through SPD, and add the JS we have written,Finally, I will introduce the principle of this operation..
2. The JS file is as follows. Of course, JS operations can not only complete such single-level menus, but alsoThe level-2 menu can be completed.If necessary, you can find the relevant information and study it yourself.
<Script language = "JavaScript"> Function custom_addlistmenuitems (M, CTX) { Strdisplaytext = "Baidu Homepage "; Straction ="Stsnavigate('HTTP: // www.baidu.com ')"; Strimagepath = CTX. imagespath + "oisweb.gif "; Menuoption=Camopt(M, strdisplaytext, straction, strimagepath ); Menuoption. ID = "id_mymenu "; Return false; } </SCRIPT> |
3. After adding the JS file, seeEffect(I am not an advertisement post of Baidu, but I am used to it like this. I will be connected to the Baidu homepage after I click it.
4,Principles: In fact, the BCD menu of SharePoint itself is implemented through JS scripts. If you are interested, you can open the position shown in layouts/2052 (Chinese version ).Core. jsFile, Sharepoint BCD menu, is to call the method in the following JS, we also follow the SharePoint mode, to call the following method to complete our desired effect.
Summary:There are many methods to accomplish this. The first method is more convenient to add the library menu in batches, while the second method is more flexible and suitable for personalized customization of individual lists. Of course, the introduction is relatively simple.