0

So i made an application page to configure a timer job and need to add a custom action to place a link for this aspx in the Site Settings and found something like:

<CustomAction
  ID="<guid>"
  GrouId = "Customization"
  Location = "Microsoft.SharePoint.SiteSettings"
  Title = "titleGoesHere"
  Rights = "FullMask"
  Sequence = "42">
   <UrlAction Url="_layouts/<stuff>.aspx" />
  </CustomAction>

so far so good but all the guides i found started with either a new solution altogether or at least a new Feature but i'd like to add the custom action to the feature which is already existing because it would be silly to have "feature A" and "feature A_Config".

so i tried adding the custom action element to the feature template.xml like:

<?xml ...>
<Feature ...>
  <CustomAction ...>
    <UrlAction ...>
  </CustomAction>
</Feature>

which seems kinda logical but i got errors every time i tried to deploy the solution because reasons, so where would i put the custom action definition?

most sites suggested to put the custom action in some elements.xml but i can't add an elements.xml to the respective feature just resources.

i suspect that i'll have to add a new module to the solution, but all this just to add a link on a site? that would seem rather nonsensical even for a microsoft product.

0

To add a custom action to an existing feature:

  1. Add a new "Empty Element" to your project (there's no option to directly create a custom action element)
  2. Add manually all the Custom Action XML declaration in it (your first piece of code in your question)
  3. Double-click your feature. You should see a double-panel window. In the left pane, you see existing elements in your solution. In the right pane, are elements included in your feature. Select the Custom Action element in the left and move it to the right panel.
  • thanks for the quick help. one other thing though: i see that after following your guide lines that the feature template.xml contains the ElementManifest Location="...". i assume that i could change the location of the elements.xml in the project to something more sensible in terms of the project structure and adjust the path in the feature template, correct? – garglblarg Jul 28 '15 at 9:23
  • If you move your elements, Visual Studio should be smart enough to automatically update your template.xml. Editing manually template.xml is an operation you often do to add very specific options, rarely to modify elements managed by VS. – Evariste Jul 28 '15 at 9:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.