Posts

Showing posts with the label add custom action

Create the Edit Control Block Menu Item

  The solution that you create in this walkthrough creates a list item context menu entry for Microsoft Word .docx files. When users open the document context menu for a given .docx file, they can click the new entry to initiate the conversion of the document. To modify the ECB menu, you create a new feature and then add a new context menu item. To create a feature      1.In the Solution Explorer, right-click Features, and then click Add Feature.    2.Type a title for the feature; for example, Convert Document.    3.Type a description for the feature; for example, This feature converts Word Open XML documents by using Word Automation Services.    4.Accept the Web default feature scope, which gives the SharePoint Server 2010 farm administrators the ability to enable or disable the feature on a per-site basis.   After you create the feature, add the new context menu item. To add a context menu item      1.In the Solution Explorer, right-click the project, point to Add, and then

Add custom menu actions programmatically in SharePoint 2010

using ( SPSite site = new SPSite ( "http://moss.dev.com" )) {         using ( SPWeb web = site . OpenWeb ())         {             SPContentType contentType = web . ContentTypes [ "Curriculum Vitae" ];             SPUserCustomAction action = web . UserCustomActions . Add ();             action . RegistrationType = SPUserCustomActionRegistrationType . ContentType ;             action . RegistrationId = contentType . Id . ToString ();             action . Location = "EditControlBlock" ;             action . Sequence = 450 ;             action . Title = "Test" ;             action . Rights = SPBasePermissions . EditListItems ;             action . Url = "http://www.google.com" ;             action . Update ();         } }