惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Help Net Security
Help Net Security
G
Google Developers Blog
雷峰网
雷峰网
WordPress大学
WordPress大学
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Engineering at Meta
Engineering at Meta
Security Latest
Security Latest
T
Threat Research - Cisco Blogs
AWS News Blog
AWS News Blog
F
Full Disclosure
C
Cybersecurity and Infrastructure Security Agency CISA
T
The Exploit Database - CXSecurity.com
J
Java Code Geeks
U
Unit 42
C
Cyber Attacks, Cyber Crime and Cyber Security
V
V2EX
C
Cisco Blogs
博客园 - 司徒正美
Project Zero
Project Zero
L
LINUX DO - 热门话题
阮一峰的网络日志
阮一峰的网络日志
Blog — PlanetScale
Blog — PlanetScale
Scott Helme
Scott Helme
A
About on SuperTechFans
Hugging Face - Blog
Hugging Face - Blog
S
Securelist
小众软件
小众软件
aimingoo的专栏
aimingoo的专栏
S
Schneier on Security
G
GRAHAM CLULEY
酷 壳 – CoolShell
酷 壳 – CoolShell
Cyberwarzone
Cyberwarzone
MongoDB | Blog
MongoDB | Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - 叶小钗
T
Threatpost
Recorded Future
Recorded Future
C
CXSECURITY Database RSS Feed - CXSecurity.com
宝玉的分享
宝玉的分享
N
News and Events Feed by Topic
人人都是产品经理
人人都是产品经理
The Register - Security
The Register - Security
S
Security Archives - TechRepublic
博客园 - Franky
N
News | PayPal Newsroom
Simon Willison's Weblog
Simon Willison's Weblog
S
SegmentFault 最新的问题
W
WeLiveSecurity
A
Arctic Wolf
B
Blog

博客园 - heli猫

修改infopath样式的小技巧(如何让文本框自适应文字多少?) 我在ABC公司的第一个项目 -- 编了个小故事,讲讲我理解的软件生命周期模型 用js调用ActiveX发outlook的meeting request的方法 - heli猫 - 博客园 如何解决带托管代码的infopath表单上传中的“正在删除”问题 通过代码 操作 sharepoint 讨论版 (转) - heli猫 IT项目经理经验谈 - 如何谈判 WSS、SharePoint 2003、MOSS、SharePoint 2009 大比对(5) WSS、SharePoint 2003、MOSS、SharePoint 2009 大比对(4) WSS、SharePoint 2003、MOSS、SharePoint 2009 大比对(3) WSS、SharePoint 2003、MOSS、SharePoint 2009 大比对(2) WSS、SharePoint 2003、MOSS、SharePoint 2009 大比对(1) MOSS数据库扩展设计方案 MOSS和其他系统的数据集成方式 MOSS站点的优化方案(结合kaneboy的文档) SharePoint应用场景介绍(一) 对象的当前状态使该操作无效 or SPListItem Update Operation is not valid due to the current state of the object 在两个不信任的域或两台独立服务器中安装SharePoint MOSS母版页制作学习笔记(二) MOSS母版页制作学习笔记(一)
推荐一篇有用文章:创建Feature扩展SharePoint列表项或文档的操作菜单项
heli猫 · 2008-10-23 · via 博客园 - heli猫

 

原文:http://msdn2.microsoft.com/en-us/library/bb418731.aspx

在SharePoint 中我们可以通过创建一个包含CustomAction元素定义的Feature来为列表项或文档添加一个自定义操作菜单项(Entry Control Block Item)。我们可以添加自定义命令到默认的SharePoint用户界面中。这些菜单命令允许用户在列表项或文档上执行特定操作。比如,我们可以在列表 项或文档的菜单中增加一项,用来将用户重定向到我们的自定义的应用程序页面。通过这种方式,我们可以创建出于SharePoint列表项或文档的操作菜单 紧密整合在一起的商业解决方案。
 
首先,创建一个自定义的Feature。我们可以将Feature定义在任何一个范围上,但通常定义在网站集或网站范围上。下面的例子定义了一个网站集范围(即Scope="Site")上的Feature,并引用了另一个CAML文件--elements.xml。

<Feature 
  
Id="AA929AFF-4602-4d7f-A501-B80AC9A4BB52" 
  Title
="A Sample Feature: Item Auditing"
  Description
="A sample Feature with an entry control block menu item"
  Scope
="Site" 
  xmlns
="http://schemas.microsoft.com/sharepoint/">
  
<ElementManifests>
    
<ElementManifest Location="elements.xml" />
  
</ElementManifests>
</Feature>

定义一个Custom Action
 
我们使用CustomAction元素来定义 SharePoint界面中各种类型的菜单项和链接。下面的CustomAction元素为文档库中的文档条目添加了一个自定义的菜单项。这是通过指定 RegistrationType属性为List,RegistrationId属性为101来实现的。这是SharePoint中默认的文档库的类型 Id。

<CustomAction 
  
Id="ItemAuditing.ECBItemMenu"
  RegistrationType
="List" 
  RegistrationId
="101"
  ImageUrl
="/_layouts/images/GORTL.GIF"
  Location
="EditControlBlock"
  Sequence
="300"
  Title
="View Audit History" >
  
<UrlAction
    
Url="~site/_layouts/ItemAudit.aspx
    ?ItemId={ItemId}&amp;ListId={ListId}"
/>
</CustomAction>

在我们创建了CustomAction元素后,还必须在其内部添加一个UrlAction元素,其中包括一个Url属性。当要把用户重定向到一个应 用程序页面(如ItemAudit.aspx)时,我们还要考虑我们是将应用程序页面运行在当前网站上下文环境中还是当前网站集环境中。下面的例子中,在 URL前面添加了动态标记~site,在运行时,~site会被替换为当前网站的URL。

~site/_layouts/ItemAudit.aspx

当我们通过定制的列表项操作菜单将用户重定向到一个自定义应用程序页面后,我们还需要将查询字符串传递到应用程序页面,以便可以通过编程获取到 SPList和SPListItem对象。SharePoint支持另外两种动态标记:{ListId}和{ItemId}。SharePoint会用列 表或文档库的GUID和列表项的ID号替换它们。

~site/_layouts/ItemAudit.aspx?ItemId={ItemId}&amp;ListId={ListId}

这种方式允许后台自定义应用程序页面(如ItemAudit.aspx)在页面初始化时得到ListId和ItemId值,进而可以针对列表项或文档进行编程,实现用户期望的自动化任务。