关于在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 -409A -8D 2C -414E 93F 67DD4"

 

            Title="my custom menu"

 

            Description="this is a custom menu"

 

            Version=" 1.0.0 .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" ?>

<Elements xmlns="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 -->

        <CustomAction Id="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>

         <CustomAction Id="ECBItemToolbar"

               RegistrationType="List"

                     RegistrationId="101"

                     Type="ECBItem"

                     Location="BugWorkaround:LocationShouldEqualEditControlBlock"

                     Sequence="106"

                     Title="Litware ECB item Command">

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

         </CustomAction>

</Elements>

 

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

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

 

步骤安装Feature

Cammand窗口下运行:

iisreset

Stsadm -o installfeature -filename mymenu\feature.xml 

你可能感兴趣的:(2007)