sharepoint 2010 如何在列表中添加功能菜单操作项

在做知识库文档管理模块中,有一个需求,就是想要在自定义列表当中,增加一个,我的收藏功能。按照sharepoint默认的列表来做,我们可以在列表的标题字段中,增加一个功能菜单项,叫我的收藏.如下图。

点击收藏,弹出一个提示框,点击确定,我们把这个纪录添加到收藏记录表。

还是沿用前面的一个sharepoint project ,sharepoint 2010 如何扩展webpart自定义属性边栏字段 custom webpart properties ,在其基础上,来做这个功能。

1。添加一个空元素,CollectionMenuItem。在这个空元素里面,添加一个CustomAction属性

<CustomAction
    Id="CollectionMenuItem"
    RegistrationType="List"
    RegistrationId="100"
    Location="EditControlBlock"
    Sequence="301"
    Title="我的收藏"
    ImageUrl="/_layouts/images/ReportServer/editreport.gif">
    <UrlAction Url="javascript:if(confirm('确认要收藏吗?')==false){ return false;}
               else{window.location.href='/_layouts/WebpartBarTest/CollectionEdit.aspx?scope=item&amp;ListId={ListId}&amp;Itemid={ItemId}&amp;CollectionType=CustomList'}"/>
 
  </CustomAction>

2。部署下project,我们会看到,所有的sharepoint custom list,都会有“我的收藏”这个菜单项。点击我的收藏,会提交一条数据到收藏记录表。

SharePoint 2010 List Template Type Registration IDs

 SharePoint RegistrationID's

Sl .No
Name
Registration ID
1
NoListTemplate
0
2
GenericList
100
3
DocumentLibrary
101
4
Survey
102
5
Links
103
6
Announcements
104
7
Contacts
105
8
Events
106
9
Tasks
107
10
DiscussionBoard
108
11
PictureLibrary
109
12
DataSources
110
13
WebTemplateCatalog
111
14
UserInformation
112
15
WebPartCatalog
113
16
ListTemplateCatalog
114
17
XMLForm
115
18
MasterPageCatalog
116
19
NoCodeWorkflows
117
20
WorkflowProcess
118
21
WebPageLibrary
119
22
CustomGrid
120
23
SolutionCatalog
121
24
NoCodePublic
122
25
ThemeCatalog
123
26
DataConnectionLibrary
130
27
WorkflowHistory
140
28
GanttTasks
150
29
Meetings
200
30
Agenda
201
31
MeetingUser
202
32
Decision
204
33
MeetingObjective
207
34
TextBox
210
35
ThingsToBring
211
36
HomePageLibrary
212
37
Posts
301
38
Comments
302
39
Categories
303
40
Facility
402
41
Whereabouts
403
42
CallTrack
404
43
Circulation
405
44
Timecard
420
45
Holidays
421
46
IMEDic
499
47
ExternalList
600
48
IssueTracking
1100
49
AdminTasks
1200
50
HealthRules
1220
51
HealthReports
1221
52
InvalidType
-1
1
NoListTemplate
0
 

Attribute

Description

Command

Required. The name of a command. The value of this attribute matches the value of aCommand attribute on an element that defines a control.

CommandAction

Required. A script statement to execute when this handler is invoked. Microsoft SharePoint Foundation calls theeval method, passing in the value of this attribute.

The value of the attribute can contain substitution tokens that are transformed at rendering. The following tokens are recognized:

  • {ItemId} – ID (GUID) taken from the list view.

  • {ItemUrl} – Web-relative URL of the list item (Url).

  • {RecurrenceId} – ID of a recurrent item (RecurrenceID).

  • {SiteUrl} – The fully qualified URL to the site (Url).

  • {ListId} – ID (GUID) of the list (ID).

  • {ListUrlDir} – Server-relative URL of the site plus the list's folder.

  • {Source} – Fully qualified request URL.

  • {SelectedListId} – ID (GUID) of the list that is currently selected from a list view.

  • {SelectedItemId} – ID of the item that is currently selected from the list view.

EnabledScript

Optional. A script statement that is executed to determine whether the command is enabled or disabled. The script expression should return aBoolean value,true if the command is enabled andfalse if not. If the ribbon is disabled, commands are grayed out and are not clickable.

As with the CommandAction attribute, theeval method is called with the value of this attribute as an argument. TheEnabledScript attribute does not support the substitution tokens that are described for theCommandAction attribute.

广州京微信息科技有限公司,.微软sharepoint解决方案提供商。

评论 8
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值