Posts

Showing posts with the label custom action

Custom Action with Custom Code

Here is a great example of Custom Action with custom code. You can link your custom action button (ECB menu item) with your custom code. http://www.thorntontechnical.com/tech/sharepoint/sharepoint-2010-context-menu-item-with-custom-code#.UG_K1k3Miz4

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...