我創建了一個自定義操作功能,可以將一個按鈕添加到列表上的「操作」菜單。當我沒有指定ControlAssembly/ControlClass屬性時,按鈕顯示出來。當我指定這些屬性時,按鈕不顯示。我曾嘗試在網站web.config中添加匹配的SafeControl元素。我正在使用VSeWSS。幫助將一個按鈕添加到列表上的「操作」菜單
更新 - 刪除鏈接到其他問題 - 不知道我是如何做到這一點。 我的問題是誰能告訴我爲什麼當我指定ControlAssembly和ControlClass屬性時,我的CustomAction按鈕沒有顯示?
UPDATE 2 - RegenConfigTemp實際上是從WebControl繼承的,對不起!具有網絡訪問權限的我的機器與我的開發機器不同,在刻錄CD時無法在它們之間移動文件。
這裏有我的文件:
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(); } } }
添加以下到Web.config
<SafeControl Assembly="WebFeature, Version=1.0.0.0, Culture=neutral, PublicKeyToken=myPKTokenHere" Namespace="WebFeature" TypeName="RegenConfigTemp" Safe="True" />
這應該是對這個問題的迴應嗎? – 2009-05-05 15:54:52