Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have an issue with custom action in SharePoint 2007, basically i have the following custom action declaration:

<Elements Id="CF60B88A-783A-44f8-A49D-43659AB51G7E" xmlns="http://schemas.microsoft.com/sharepoint/">
  <CustomAction Id="MyAction.GoToGoogle"
  GroupId="ActionsMenu"
  Location="Microsoft.SharePoint.StandardMenu"
  RegistrationType="List"
  Rights="Read"
  Sequence="0"
  Title="Go to google"
  ControlAssembly="MyProject, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cd112ea8ee9f48d3"
  ControlClass="MyProject.CustomActions.MyCustomAction">
    <UrlAction Url="http://www.google.be"/>
  </CustomAction>
</Elements>

So basically this custom action is bind to a custom class, but as i said already my action doesn't appear at all, if i delete the control class and control assambly then it is wel visible.

Maybe my delcaration is wrong? Anyone can point me to a mistake?

UPDATE:

Here is the class

namespace MyProject.CustomAction
{
    public class MyCustomAction : WebControl
    {
      protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
         }

        protected override void CreateChildControls()
        {
            base.CreateChildControls();
        }
    }
  }
}
share|improve this question
    
without code or error am afraid if anyone would know whats wrong with your custom class, try ULS viewer to find out error, here's a guide sharepointbulletin.blogspot.co.uk/2013/02/… –  Muhammad Raja Feb 25 '13 at 14:06
    
updated post with code –  Shkipper Feb 25 '13 at 14:47
add comment

2 Answers

Change your elements.xml to this,

<?xml version="1.0" encoding="utf-8" ?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <Control
    ControlAssembly="MyProject.CustomAction, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cd112ea8ee9f48d3"
    ControlClass="MyProject.CustomActions.MyCustomAction" 
    Sequence="1"
    Id="AdditionalPageHead"/>

  <CustomAction
      Id="MyActionGoToGoogle"
      Title="Go To Google"
      Location="Microsoft.SharePoint.StandardMenu"
      RegistrationId="101"
      RegistrationType="List"
      GroupId="ActionsMenu"
      ShowInLists="TRUE"
      Sequence="1"
      ControlAssembly="MyProject.CustomAction, Version=1.0.0.0, Culture=neutral, PublicKeyToken=cd112ea8ee9f48d3"
      ControlClass="MyProject.CustomActions.MyCustomAction" >
    <UrlAction Url="http://www.google.be"/>
  </CustomAction>

</Elements>

and your custom class should look like this,

namespace MyProject.CustomAction
{
    public class MyCustomAction : WebControl
    {
      protected override void OnLoad(EventArgs e)
        {
            this.EnsureChildControls();
            base.OnLoad(e);
         }
    }
  }
}
share|improve this answer
    
nope doesn't work :( –  Shkipper Feb 25 '13 at 16:19
    
did you tried ULS viewer to find out whats the error –  Muhammad Raja Feb 25 '13 at 16:19
    
i don't see any records about this, i think that nothing is being loaded properly. –  Shkipper Feb 25 '13 at 22:06
add comment
up vote 0 down vote accepted

The solution was found, basically everything was ok, the problem was due to not registering the class as a safe control, after doing it, the custom action worked perfectly

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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