Sharepoint 2007 - 某些文件类型的自定义上下文菜单

发布于 2024-09-11 13:37:50 字数 486 浏览 1 评论 0原文

我想知道是否有人可以帮助我使用 Sharepoint 2007。我想要做的是将自定义菜单项添加到上下文菜单(单击文档或其他项目时打开的菜单)。

现在,菜单如下所示: 图片

我想添加一个项目,例如“Do stuff”这个菜单。主要问题:

  1. 我希望此项目仅出现在特定文件类型的菜单中(例如仅适用于 .html,而不适用于 .doc);
  2. 当我单击此项(“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:

  1. I wish this item to appear only in menus for a certain file type (e.g. only for .html but not for .doc);
  2. 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

扮仙女 2024-09-18 13:37:50

您必须像这样实现 CustomAction:

<CustomAction
   Id="YourUniqueId"
   Location="EditControlBlock"
   RegistrationType="FileType"
   RegistrationId="html"
   Sequence="20"
   Title="The text you want">
  <UrlAction Url="~site/_layouts/company/ActionPage.aspx?List={ListId}&ID={ItemId}" />
</CustomAction>

您在 UrlAction 的 Url 中放入的内容取决于您想要执行的操作。它可以是 JavaScript 或页面或处理程序的 url。

在我的示例中,它是一个获取 QueryParameters 的页面,以便 SPContext.Current.ListItem 将包含所选文档列表项。

You have to implement a CustomAction like this:

<CustomAction
   Id="YourUniqueId"
   Location="EditControlBlock"
   RegistrationType="FileType"
   RegistrationId="html"
   Sequence="20"
   Title="The text you want">
  <UrlAction Url="~site/_layouts/company/ActionPage.aspx?List={ListId}&ID={ItemId}" />
</CustomAction>

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.

情愿 2024-09-18 13:37:50
<?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>
<?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>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文