Sharepoint 2007 - 某些文件类型的自定义上下文菜单
我想知道是否有人可以帮助我使用 Sharepoint 2007。我想要做的是将自定义菜单项添加到上下文菜单(单击文档或其他项目时打开的菜单)。
现在,菜单如下所示: 图片
我想添加一个项目,例如“Do stuff”这个菜单。主要问题:
- 我希望此项目仅出现在特定文件类型的菜单中(例如仅适用于 .html,而不适用于 .doc);
- 当我单击此项(“Do stuff”)时,我想调用自定义外部代码(用 C# 编写,exe 或 DLL),它接受单击的文件的名称作为输入参数。
我知道实现此目的的方法是使用自定义操作(2007 年不需要 javascript 编辑,对吧?)。但由于我对 MOSS 很陌生,我有点迷失,不知道到底要做什么以及从哪里开始,所以非常感谢任何帮助。
I was wondering if someone could help me out with Sharepoint 2007. What I want to do is to add a custom menu item to a context menu (the menu that opens when you click a document or another item).
Right now, the menu looks like this:
picture
I want to add an item, "Do stuff" for example, to this menu. Major problems:
- I wish this item to appear only in menus for a certain file type (e.g. only for .html but not for .doc);
- When I click this item ("Do stuff"), I want to call custom external code (written in C#, either an exe or a DLL), which accepts the name of the clicked file as an input parameter.
I understand the way to achieve this is by using Custom Actions (no javascript editing required in 2007, right?). But since I'm quite new to MOSS, I'm a bit lost and not sure what exactly to do and where to start, so any help is greatly appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
发布评论
评论(2)
<?xml version="1.0" encoding="utf-8"?>
<Elements Id="d0574a32-59ce-4561-9496-ccf17da37a35" xmlns="http://schemas.microsoft.com/sharepoint/">
<CustomAction Id="Test2"
Location="EditControlBlock"
RegistrationType="FileType"
//docx = documents, txt = text files, html = html files**
RegistrationId="docx" Sequence="10"
Title="View Item Properties">
<UrlAction Url="~site/_layouts/WSSHOL/ViewPageRedirect.aspx?listid={ListId}&itemid={ItemId}" />
</CustomAction>
</Elements>
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
您必须像这样实现 CustomAction:
您在 UrlAction 的 Url 中放入的内容取决于您想要执行的操作。它可以是 JavaScript 或页面或处理程序的 url。
在我的示例中,它是一个获取 QueryParameters 的页面,以便 SPContext.Current.ListItem 将包含所选文档列表项。
You have to implement a CustomAction like this:
What you put in the Url of UrlAction depends on what you want to do. It can be JavaScript or the url of a Page or Handler.
In my example it's a Page which gets the QueryParameters so that SPContext.Current.ListItem will contain the selected documents listitem.