1.创建一个文件夹名称SimpleFormToolbarButton,然后在这个文件夹下创建两个.xml文件:Feature.xml和Elements.xml。
2.Feature.xml示例代码如下:
<Feature Title="New Simple Form Toolbar Button"
Scope="Web"
Id="GUID"
xmlns="http://schemas.microsoft.com/sharepoint/">
<ElementManifests>
<ElementManifest Location="Elements.xml" />
</ElementManifests>
</Feature>
参数分析:Scope表示范围,一共四种:
Farm:服务器场范围,这个是最大的范围
WebApplcation:你可以看就是一个http://ccccc:vv之类的一种形式。在一个服务器场中,会有多个webapplication
Site:site collection就是网站集。
Web:subsite网站集下的一个web
Id 是唯一标示,可以用VS.net生成。打开vs.net,工具-〉创建Guid.
<ElementManifest Location="Elements.xml" />表示调用的xml文件。
3.Elements.xml示例代码:
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<CustomAction Title="Simple"
Sequence="10"
RegistrationType="List"
RegistrationId="104"
Location="EditFormToolbar"
Id="Simple Toolbar">
<UrlAction Url="/_layouts/SampleUrl.aspx" />
</CustomAction>
</Elements>
Id:为这个CustomAction指定一个文本标识符
Sequence:指定action的优先级的顺序
Location:Action出现的位置,在MSDN中有对Location有详尽的列表,以后会提到。你不仅可以对action指定title还可以加上你想要的图标。
具体包括:EditControlBlock(编辑), NewFormToolbar, DisplayFormToolbar, and EditFormToolbar(编辑里面).
RgistrationType:Specifies the registration attachment for a per-item action. (不好意思,我不知道该如何翻译才更合适)。这是个可选的文本属性。从我的理解来说,这是对那些类似list中的item指定action。有ContentType List FileType ProgID。这里指定的是List,因为announcements是List的一种类型。
RegistrationID:104代表着announcements。
-1 InvalidType
100 Generic list //列表
101 Document library //文档库
102 Survey //调查
103 Links list //网站链接
104 Announcements list
105 Contacts list
106 Events list
107 Tasks list //任务
108 Discussion board //讨论板
109 Picture library
110 Data sources
111 Site template gallery
113 Web Part gallery
114 List template gallery
115 XML Form library
120 Custom grid for a list
200 Meeting Series list
201 Meeting Agenda list
202 Meeting Attendees list
204 Meeting Decisions list
207 Meeting Objectives list
210 Meeting text box
211 Meeting Things To Bring list
212 Meeting Workspace Pages list
300 Portal Sites list.
1100 Issue tracking
2002 Personal document library
2003 Private document library
关于RegistrationID等具体的数值在MSDN中有详细的列表。
4. SampleUrl.aspx表示这个Feature连接的地址,示例代码如下:
<html>
<head runat="server">
<title>Sample Page</title>
</head>
<body>
<p>Hello, world!</p>
</body>
</html>
5.以上需要的文件都做好了,下一步就是把Feature部署到MOSS上。
cmd,cd C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN
然后,stsadm -o installfeature -filename SimpleFormToolbarButton\Feature.xml 。这样就注册成功了。
6.到MOSS里查看,网站操作-〉网站设置-〉修改所有网站设置-〉网站库和列表,新建内容通知。建完之后,新建一个通知,然后修改,就可以看到。
浙公网安备 33010602011771号