关于在MOSS 2007中创建自定义菜单项的方法

本文以 Feature 的形式对 SharePoint 的界面元素进行定制 , 实现了对网站中的 Site Action 下拉菜单添加自定义菜单项的功能 , 实现了对文档库的工具条上的菜单增加自定义菜单项的功能 .

步骤1:创建一个Feature.xml文件

Features目录下创建一个目录例如mymenu,在其中创建一个Feature.xml文件,文件内容如下:

<?xml version="1.0" encoding="utf-8" ?>

<!-- _lcid="1033" _version="12.0.4017" _dal="1"-->

<!-- _LocalBinding -->

<Feature Id="6098EC11-8128<chmetcnv tcsc="0" numbertype="1" negative="True" hasspace="False" sourcevalue="409" unitname="a" w:st="on">-409A</chmetcnv>-8D<chmetcnv tcsc="0" numbertype="1" negative="False" hasspace="False" sourcevalue="2" unitname="C" w:st="on">2C</chmetcnv>-414E<chmetcnv tcsc="0" numbertype="1" negative="False" hasspace="False" sourcevalue="93" unitname="F" w:st="on">93F</chmetcnv>67DD4"

Title="my custom menu"

Description="this is a custom menu"

Version="<chsdate isrocdate="False" islunardate="False" day="30" month="12" year="1899" w:st="on">1.0.0</chsdate>.0"

Scope="Web"

Hidden="FALSE"

DefaultResourceFile="customDocumentLibrary"

xmlns="http://schemas.microsoft.com/sharepoint/">

<ElementManifests>

<ElementManifest Location="lightup.xml" />

</ElementManifests>

</Feature>

步骤2:创建Feature的描述文件lightup.xml

文档的内容如下:

<?xml version="1.0" encoding="utf-8" ?>

<Elementsxmlns="http://schemas.microsoft.com/sharepoint/">

<!-- create command link site setting page -->

<CustomAction Id="SiteSettings" GroupId="Customization"

Location="Microsoft.SharePoint.SiteSettings"

Sequence="106"

Title="Custom Litware Site Setting Command">

<UrlAction Url="/_layouts/litwarefeaturelab.aspx?command=SiteSettingCommand"/>

</CustomAction>

<!--Add command to site action dropdow -->

<CustomActionId="SiteActionsToolbar111111111111"

GroupId="SiteActions"

Location="Microsoft.SharePoint.StandardMenu"

Sequence="1000"

Title="Litware custom Action"

Description="custom litware site action"

ImageUrl="/_layouts/images/ACL16.GIF">

<UrlAction Url="/_layouts/litwarefeaturelab.aspx?command=SiteActionCommand"/>

</CustomAction>

<!-- Document Library Toolbar New Menu DropDown-->

<CustomAction Id="DocLibNewToolbar"

RegistrationType="List"

RegistrationId="101"

GroupId="NewMenu"

Rights="ManagePermissions"

Location="Microsoft.SharePoint.StandardMenu"

Sequence="1000"

Title="Litware Custom New Command"

Description="THis Command Creates a new Litware doc"

ImageUrl="/_layouts/images/ACL16.GIF">

<UrlAction Url="/_layouts/litwarefeaturelab.aspx?command=NewDocCommand"/>

</CustomAction>

<!-- Document library Toolbar Actions Menu Dropdown-->

<CustomAction Id="DocLibActionsToolbar"

RegistrationType="List"

RegistrationId="101"

GroupId="ActionsMenu"

Rights="ManagePermissions"

Location="Microsoft.SharePoint.StandardMenu"

Sequence="1000"

Title="Litware Command on Document Library"

Description="THis Command Creates a new Litware doc"

ImageUrl="/_layouts/images/ACL16.GIF">

<UrlAction Url="/_layouts/litwarefeaturelab.aspx?command=DocLibCommand"/>

</CustomAction>

<CustomActionId="ECBItemToolbar"

RegistrationType="List"

RegistrationId="101"

Type="ECBItem"

Location="BugWorkaround:LocationShouldEqualEditControlBlock"

Sequence="106"

Title="Litware ECB item Command">

<UrlActionUrl="/_layouts/litwarefeaturelab.aspx?command=SiteSettingCommand"/>

</CustomAction>

</Elements>

其中第一个CustomActionSite Setting页面中的LOOK AND FEEL标题下创建了一个自定义链接.第二个CustomAction在页面的Site Action菜单下增加了一个用户自定义菜单项.第三个CustomAction在文档库的New下拉菜单下创建了一个自定义菜单项.第四个CustomAction在文档库的Action下拉菜单下创建了一个自定义菜单项.

注意第五个CustomAction本来是在文档库的每个列表项的菜单上增加一个菜单项,但是不知什么原因不能正确加入,有待进一步的研究.

步骤3安装Feature

Cammand窗口下运行:

iisreset

Stsadm-o installfeature-filenamemymenu\feature.xml

你可能感兴趣的:(xml,Web,Microsoft,F#,SharePoint)