简体   繁体   English

如何将事件接收器附加到生产服务器上的列表/文档库?

[英]How to attach an Event Receiver to a List/Document Library on Production server?

I have created/bound an Event Receiver to a document library in Share Point 2010 to read the content of an excel file and load a list from the content. 我已将事件接收器创建/绑定到Share Point 2010中的文档库,以读取excel文件的内容并从内容中加载列表。

Everything works well in development, I don't have access to the production servers so I logged a ticket to IT deploy to production server (attaching the .wsp of ER). 在开发过程中一切运行良好,我无法访问生产服务器,因此我将一张票据记录到IT部署到生产服务器(附加了ER的.wsp)。

The guy has deployed/activated the ER in the Production, Now I am not sure how to attach it to particular document library and how to validate if/when it is attached. 这个人已经在生产中部署/激活了ER,现在我不知道如何将它附加到特定的文档库以及如何验证是否/何时附加它。

  1. If you used the VS2010 SharePoint templates and it asked you for a specific library, you probably have to modify it for your production library. 如果您使用VS2010 SharePoint模板并且它要求您提供特定库,则可能需要为生产库修改它。 In your VS solution look at the elements.xml file. 在VS解决方案中,查看elements.xml文件。 You should see a at the top. 你应该在顶部看到一个。 If your Event Handler is scoped to web, you can change the "..." to the actual library name. 如果您的事件处理程序的范围限定为Web,则可以将“...”更改为实际的库名称。 Example: . 示例:。

  2. Rebuild the WSP. 重建WSP。 Your support group should be running the add-spsolution and install-spsolution powershell commands to add it and install it to the farm. 您的支持组应该运行add-spsolution和install-spsolution powershell命令来添加它并将其安装到服务器场。

  3. If you can get to the sub site in questions features (Site settings->Manage Site features) you should see your event handler present but deactivated. 如果您可以在问题功能(站点设置 - >管理站点功能)中访问子站点,您应该看到您的事件处理程序存在但已停用。

  4. Click to activate it. 单击以激活它。

  5. Without server access (to see the logs in the 14 hive) it is tough to really see if it is attached. 如果没有服务器访问权限(查看14个配置单元中的日志),很难真正看到它是否已附加。 If your support team uses SharePoint Manager they can look to see if the handler is really attached to the library in question. 如果您的支持团队使用SharePoint Manager,他们可以查看处理程序是否真正附加到相关库。 Short of that, what I've seen people do is put a small chunk of code in their handler (item added/updated/etc.) that will update a status column on the library when it fires (eg "Handler Fired"). 除此之外,我见过人们做的是在他们的处理程序中添加一小块代码(项目添加/更新/等),它将在库触发时更新库中的状态列(例如“Handler Fired”)。 This way you can actually see if it is firing. 这样你就可以看到它是否正在射击。 Additionally, you could put any error message you might get in the code into this column (eg "Could not load file to list", etc."). 此外,您可以将代码中可能出现的任何错误消息放入此列(例如“无法将文件加载到列表中”等)“)。

If with your WSP the dll that contains the event receiver is deployed in GAC on production then you can attach the event receiver to a list/library with powershell. 如果使用您的WSP,包含事件接收器的DLL在生产中部署在GAC中,那么您可以使用powershell将事件接收器附加到列表/库。

$type = "ItemAdding" #or any other type, like ItemDeleting, ItemAdded, ItemUpdating ...
$assembly = "YourAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=5eff...(here goes assebly's token"
$class = "Your Class"

$list.EventReceivers.Add($type, $assembly, $class)

Source: http://naimmurati.wordpress.com/2012/03/22/add-modify-or-delete-list-event-receivers-with-powershell/ 资料来源: http//naimmurati.wordpress.com/2012/03/22/add-modify-or-delete-list-event-receivers-with-powershell/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何将事件接收器附加到 sharepoint 中的自定义列表? - how to attach an event receiver to a custom list in sharepoint? 事件接收器未触发-文档库 - Event Receiver not firing -Document Library 在使用事件接收器上传之前,如何检查库文档文件的大小 - How to check size of library document file before uploaded with event receiver 如何以编程方式将事件接收器附加到SPList? - How to attach Event Receiver to SPList programmatically? 如何在 SharePoint 事件接收器中将文本文件从模块复制到未创建的文档库? - How to copy a text file from a module to a document library that is not created, in SharePoint event receiver? 使用Sharepoint事件接收器在文档库中创建一个文件夹 - Create a folder in document library using Sharepoint event receiver 使用事件接收器更新SharePoint库中的文档元数据 - Update Document meta data in SharePoint library using Event Receiver 如何将当前 Word 文档附加到新的 Sharepoint 2013 列表项 - How to attach a current Word document to a new Sharepoint 2013 list item ClrMD无法连接到生产服务器上的进程 - ClrMD could not attach to process on production server 打印文档和打印机后台处理程序的附加事件 - Print document and attach event for printer spooler
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM