0

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();
        }
    }
  }
}
1

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);
         }
    }
  }
}
  • 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
1

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

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.