SharePoint 2013 development--developing a custom Action app
Source: Internet
Author: User
<span id="Label3"></p>?<span style="font-family:Microsoft YaHei;font-size:14px;"><span style="font-family:Microsoft YaHei;font-size:14px;">Blog Address: http://blog.csdn.net/FoxDave</span></span><p><p><span style="font-family:Microsoft YaHei;font-size:14px;">Custom actions are what we call the Ribbon and the ECB (Edit Control Block) before SharePoint 2013, We can create custom ribbon and ECB by adding XML elements in the solution, to the 2013 era, The app can do the same thing, so let's take a look at how to use the app to create custom actions for list Entries.</span></p></p><p><p><span style="font-family:Microsoft YaHei;font-size:14px;">In addition to some details on the configuration items, creating a SharePoint App project is just as basic as mentioned Earlier. The list entry information is passed through the query string to the external managed Page.</span></p></p><p><p><span style="font-family:Microsoft YaHei;font-size:14px;">Start by creating a SharePoint app project named Customactionapptest.</span></p></p><p><p><span style="font-family:Microsoft YaHei;font-size:14px;">Next we add a new form to the Web project named Customactiontarget.aspx.</span></p></p><p><p><span style="font-family:Microsoft YaHei;font-size:14px;">Add a Server-side control under the empty DIV element on the page:</span></p></p><span style="font-family:Microsoft YaHei;font-size:14px;"><span style="font-family:Microsoft YaHei;font-size:14px;"></span></span><pre class="html" name="code"><pre class="html" name="code"><asp:literal id= "Literal1" runat= "server" text= "Hello to the world from a custom action app" > </ Asp:literal></pre></pre><p><p><span style="font-family:Microsoft YaHei;font-size:14px;"></span><span style="font-family:Microsoft YaHei;font-size:14px;">Add the following code to the Page_Load method in the background CS code page:</span></p></p><span style="font-family:Microsoft YaHei;font-size:14px;"><span style="font-family:Microsoft YaHei;font-size:14px;"></span></span><pre class="csharp" name="code"><pre class="csharp" name="code">Literal1.text = String. Empty; foreach (string querystringparam in Request.querystring) { literal1.text = literal1.text + "<br>" + Querystringparam + "=" + request.querystring[querystringparam]; }</pre></pre><p><p><span style="font-family:Microsoft YaHei;font-size:14px;"></span><span style="font-family:Microsoft YaHei;font-size:14px;">After the operation is complete as shown:</span></p></p><p><p><span style="font-family:Microsoft YaHei;font-size:14px;"></span></p></p><p><p><span style="font-family:Microsoft YaHei;font-size:14px;">Below we add a custom action through a SharePoint app Project. Right click on the project node, Select Add New item, Select menu item Custom action, name for menuitemcustomactiontest, Click Next to pop up the Wizard.</span></p></p><p><p><span style="font-family:Microsoft YaHei;font-size:14px;"></span></p></p><p><p><span style="font-family:Microsoft YaHei;font-size:14px;">after selecting the above option, click next, Define the text of the menu item and the target page of the navigation, specify a value for the text, Select the Web Form we created earlier,</span> <span style="font-family:Microsoft YaHei;font-size:14px;">Click the Finish button to complete the Creation. </span></p></p><p><p><span style="font-family:Microsoft YaHei;font-size:14px;"></span></p></p><p><p><span style="font-family:Microsoft YaHei;font-size:14px;">Let's create a custom Ribbon Again. Right click on the project node, Select Add New item, Select Ribbon custom action, name for ribboncustomactiontest, Click Next to pop up the Wizard.</span></p></p><p><p><span style="font-family:Microsoft YaHei;font-size:14px;">The first section selects the same as above, click next, Define the Ribbon location for Ribbon.documents.manage,ribbon text and the Ribbon navigation target page, Click the Finish button to complete the Creation.</span></p></p><p><p><span style="font-family:Microsoft YaHei;font-size:14px;"></span></p></p><p><p><span style="font-family:Microsoft YaHei;font-size:14px;">Creating these two objects generates two Elements.xml element definition files, and we modify the query string parameters (?) for the URL in which the action is Related. The following Sections) are as Follows:</span></p></p><p><p><span style="font-family:Microsoft YaHei;font-size:14px;">ECB</span></p></p><span style="font-family:Microsoft YaHei;font-size:14px;"><span style="font-family:Microsoft YaHei;font-size:14px;"></span></span><pre class="html" name="code"><pre class="html" name="code">{standardtokens}& splistitemid={itemid}& splistid={listid}& spsource={source}& splisturldir={listurldir}& spitemurl={itemurl}</pre></pre><p><p>Ribbon</p></p><p><p></p></p><pre class="html" name="code"><pre class="html" name="code">{standardtokens}& hosturl={hosturl}& source={source}& listurldir={listurldir}& listid={selectedlistid}&itemid={selecteditemid}</pre></pre><p><p></p></p><p><p></p></p><p><p></p></p><p><p></p></p><p><p><span style="font-family:Microsoft YaHei;font-size:14px;">Note that the values of the two parameter names are slightly different, the specific query string parameter values can be explored on their own, not limited to the listed, and it seems that the ribbon can not be taken to the value of the itemurl, there are friends who know welcome to Share. ok, done, then execute F5 to deploy our Project.</span></p></p><p><p><span style="font-family:Microsoft YaHei;font-size:14px;">After pop-up the browser, jump to our developer site, click on the left navigation document into the document library view page, If there is no document to upload a new document, Select our uploaded documents, click the Ribbon or the ECB menu, you can see our custom action, Click to see the Effect.</span></p></p><p><p></p></p><p><p></p></p><p><p><br></p></p><span style="font-family:Microsoft YaHei;font-size:14px;"><span style="font-family:Microsoft YaHei;font-size:14px;">attached:? Description of some parameters</span></span><span style="font-family:Microsoft YaHei;font-size:14px;"><span style="font-family:Microsoft YaHei;font-size:14px;">~remoteappurl-represents The URL of the Web page where the remote hosting provider application Resides.<br>Customactiontarget.aspx-the aspx page of the target site that implements the custom Action. </span></span><span style="font-family:Microsoft YaHei;font-size:14px;"><span style="font-family:Microsoft YaHei;font-size:14px;">Standardtokens-provides a standard app password for the page, including the host site URL and context Password.<br>Source-the source URL that triggers the custom action, which is used to jump the page after the Operation Completes.<br>Listurldir/listid-triggers the list path/list ID where the custom action is Located.<br>Itemurl/itemid-the List Entry ID of the url/that triggered the custom Action. </span></span><span style="font-family:Microsoft YaHei;font-size:14px;"><span style="font-family:Microsoft YaHei;font-size:14px;">More Information</span></span>??<p><p>SharePoint 2013 development--developing a custom Action app</p></p></span>
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