Reputation: 1104
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.
Everything works well in development, I don't have access to the production servers so I logged a ticket to I.T deploy to production server (attaching the .wsp of ER).
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.
Upvotes: 0
Views: 5402
Reputation: 373
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.
$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)
Upvotes: 1
Reputation: 61
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. In your VS solution look at the elements.xml file. You should see a at the top. If your Event Handler is scoped to web, you can change the "..." to the actual library name. Example: .
Rebuild the WSP. Your support group should be running the add-spsolution and install-spsolution powershell commands to add it and install it to the farm.
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.
Click to activate it.
Without server access (to see the logs in the 14 hive) it is tough to really see if it is attached. If your support team uses SharePoint Manager they can look to see if the handler is really attached to the library in question. 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 (e.g. "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 (e.g. "Could not load file to list", etc.").
Upvotes: 1