Help add a button to the Actions menu in the list

I created a CustomAction function to add a button to the Actions menu in the list. When I leave out the ControlAssembly / ControlClass attributes, a button appears. When I specify these attributes, the button is not displayed. I tried to add the appropriate SafeControl element in the web.config site. I am using VSeWSS.

UPDATE - remote link to another question - not sure how I did it. My question is, can anyone tell me why my CustomAction button doesn't appear when I specify the ControlAssembly and ControlClass attributes?

UPDATE 2 - RegenConfigTemp actually inherits from WebControl, sorry! My machine with internet access is different from my dev machine and there is no way to move files between them without burning the CD.

here are my files:

manifest.xml
<? xml version = "1.0" encoding = "utf-8"?>
<Solution SolutionId = "GUIDHERE" xmlns = "http://schemas.microsoft.com/sharepoint/">
  <FeatureManifests>
    <FeatureManifest Location = "RegenConfigTemp \ feature.xml" />
  </FeatureManifests>
  <Assemblies>
    <Assembly Location = "WebFeature.dll" DeploymentTarget = "GlobalAssemblyCache" />
  </Assemblies>
</Solution>
feature.xml
<Feature Id = "GUIDHERE" Title = "RegenConfigTemp" Scope = "Web" Version = "1.0.0.0" Hidden = "FALSE" DefaultResourceFile = "core" xmlns = "http://schemas.microsoft.com/sharepoint/" >
  <ElementManifests>
    <ElementManifest Location = "RegenConfigTemp \ Module.xml" />
  </ElementManifests>
</Feature>
Module.xml
<? xml version = "1.0" encoding = "utf-8"?>
<Elements Id = "GUIDHERE" xmlns = "http://schemas.microsoft.com/sharepoint/">
  <CustomAction
    Id = "GUIDHERE"
    RegistrationType = "List"
    RegistrationId = "1981"
    GroupId = "ActionsMenu"
    Location = "Microsoft.SharePoint.StandardMenu"
    Sequence = "1000"
    Title = "Regenerate List Contents"
    ControlAssembly = "WebFeature, Version = 1.0.0.0, Culture = neutral, PublicKeyToken = myPKTokenHere"
    ControlClass = "WebFeature.RegenConfigTemp"
  > </CustomAction>
</Elements>
RegenConfigTemp.cs
using System;
using System.Runtime.InteropServices;
using System.Web.UI.WebControls;
using Microsoft.SharePoint.WebControls;

namespace WebFeature
{
    [Guid ("GUID HERE MATCHES 1st GUID in Module.xml")]
    public class RegenConfigTemp: WebControl
    {
        protected override void OnLoad (EventArgs e)
        {
            this.EnsureChildControls ();
            base.OnLoad (e);
        }
        protected override void CreateChildControls ()
        {
            base.CreateChildControls ();
        }
    }
}

I added the following to web.config

<SafeControl Assembly = "WebFeature, Version = 1.0.0.0, Culture = neutral, PublicKeyToken = myPKTokenHere" Namespace = "WebFeature" TypeName = "RegenConfigTemp" Safe = "True" />
+1


source to share


3 answers


It turns out the problem was in the Module.xml. I have lost the "equals" sign after "Version" on this (amended) line: ControlAssembly = "WebFeature, Version = 1.0.0.0, Culture = neutral, PublicKeyToken = myPKTokenHere"

I hit the right b / c path. I found the Sharepoint diagnostic log and the first comment on this blog: http://blog.lostparticles.net/?p=23 was my problem.



Thanks for the help y'alls.

UPDATE: I also had to fix the web.config line. I ended up putting the safecontrol line in the manifest instead of directly in the web.config; thanks JMD. (BTW, why doesn't VSeWSS do this for me when it does it for web parts?)

+1


source


Are you sure your code should display something? Which class do you inherit and where is your rendering code? Have you checked the SharePoint log for any exception?



This is not an answer to your question, but you can put your SafeControl tag in your manifest instead of web.config.

0


source


Should RegenConfigTemp

I inherit from something? You are not currently adding any controls, so if you override an empty control so you won't see anything. If nothing else, try setting a breakpoint or adding some diagnostic trace in CreateChildControls()

to see if the code is executing.

0


source







All Articles