创建一个菜单功能
1、创建一个菜单功能,该菜单功能是在网站设计中,属于网站集级别:
1.1创建文件Feature.xml
内容:
<?xml version="1.0" encoding="utf-8" ?>
<Feature xmlns="http://schemas.microsoft.com/sharepoint/"
Id="BAF0C4A7-C707-47d2-809B-8130BC344048"
Scope="Site"
Title="Download Book Code"
Description="A feature to open the code download page on Apress."
>
<ElementManifests>
<ElementManifest Location="Elements.xml" />
</ElementManifests>
</Feature>
1.2 创建文件Elements.xml
内容:
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<CustomAction
Id=" 175B270F-239E-4955-97CB-94227E5DAA17"
GroupId="SiteActions"
Location="Microsoft.SharePoint.StandardMenu"
Sequence="1000"
Title="Download Book Code"
Description="This action takes you to the Apress code download page."
ImageUrl="_layouts/images/hand.jpg">
<UrlAction Url="http://www.ECJY.COM"/>
</CustomAction>
</Elements>
1.3 在C:"Program Files"Common Files"Microsoft Shared"web server extensions"12"TEMPLATE"FEATURES中添加一个文件夹,该文件的名称要取得和功能所表现的意思要接近。这样方便以后的维护。例如:CodeDownload。将刚才的两个文件拷贝到该文件中。同时将图片hand.jpg拷贝到C:"Program Files"Common Files"Microsoft Shared"web server extensions"12"TEMPLATE"images中,该图片是菜单图片。
1.4 注册该功能。
在DOC命令操作窗体中,将路径定位到C:"Program Files"Common Files"Microsoft Shared"web server extensions"12"bin,然后敲入:STSADM.EXE -o installfeature -filename CodeDownload"feature.xml –force。
1.5 进入首要网站——网站设计——网站集管理——网站集功能,这时候可以看到:有一项功能的名字和Elements.xml文件中的TITLE节点的内容一样,启动即可。
2.自定义一个网页。
2.1 创建feature.xml
内容:
<?xml version="1.0" encoding="utf-8" ?>
<Feature xmlns="http://schemas.microsoft.com/sharepoint/"
Id="2D9921AE-D263-4e2b-B4F7-ABDD6223C8B0"
Scope="Site"
Title="Content Type Hierarchy"
Description="Shows the hierarchical relationship between content types."
>
<ElementManifests>
<ElementManifest Location="Elements.xml" />
</ElementManifests>
</Feature>
2.2 创建 Elements.xml
内容
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<CustomAction
Id="77C52F5D-D5C3-46a1-96EA-2B6B434564C2"
GroupId="Galleries"
Location="Microsoft.SharePoint.SiteSettings"
Sequence="0"
Title="Site Content Types Hierarchy"
244 CHAPTER 7 n SHAREPOINT CUSTOM FEATURES AND WORKFLOWS
Figure 7-3. Showing content types in a hierarchy
Description="Displays a hierarchy of site content types.">
<UrlAction Url="_layouts/ContentTypeHierarchy.aspx"/>
</CustomAction>
</Elements>
注意:与第一个练习比较最关键的不同是:Elements.xml的GroupId,该值指示功能按钮的区域或者位置。
2.3 创建一个网页ContentTypeHierarchy.html放到C:"Program Files"Common Files"Microsoft Shared"web server extensions"12"TEMPLATE"LAYOUTS中。
2.4 注册该功能
STSADM.EXE -o installfeature -filename ContentTypeHierarchy"feature.xml
2.5 启动该功能
进入首要网站——网站设计——网站集管理——网站集功能,这时候可以看到:有一项功能的名字和Elements.xml文件中的TITLE节点的内容一样,启动即可。
2.6 该功能在:进入首要网站——网站设计——库