The text of this article is not in this database — only its details are. The old site it was published on is gone, but the Internet Archive kept a copy: Implementing Event Handler in Sharepoint
5 Comments
Join the conversation! Your thoughts help the community grow.
Sign in to leave a comment.

nitingupta4uPosted Feb 6, 2012, 5:17 AM
http://code.google.com/p/sharepoint-eventhandlers-manager/ SharePoint Event Handlers Manager allows admins to browse, add, edit and remove SharePoint event handlers from any list or web. This SharePoint solution provides two features that enables admins to play with event handlers from within SharePoint interface. It is very simple to use and doesn't require any configuration to start. Just download and install, and you are all set.
RamyaPosted Jun 22, 2010, 5:11 AM
Hi, Is there any option to activate the feature to a particular list?
Shweta AgrawaleditedPosted Apr 21, 2010, 2:54 AMEdited Apr 21, 2010, 3:02 AM
using System; using System.Runtime.InteropServices; using System.Web.UI; using System.Web.UI.WebControls; using System.Xml.Serialization; using Microsoft.SharePoint; using Microsoft.SharePoint.WebControls; using Microsoft.SharePoint.WebPartPages; using System.Diagnostics; namespace SiteCollectionLists { [Guid("47bb4600-1a80-42c8-95a4-dd0c8b2722b9")] [CLSCompliant(false)] public class SiteCollectionLists : WebPart { TreeView tvListnLib; public SiteCollectionLists() { } protected override void RenderWebPart(HtmlTextWriter output) { try { tvListnLib.RenderControl(output); } catch (Exception Ex) { EventLog.WriteEntry(Ex.Message.ToString(), "", EventLogEntryType.Error); } } protected override void CreateChildControls() { try { // TODO: add custom rendering code here. tvListnLib = new TreeView(); tvListnLib.ShowLines = true; tvListnLib.EnableViewState = true; tvListnLib.CollapseAll(); tvListnLib.ID = "lstname"; PopulateList(); Controls.Add(tvListnLib); } catch (Exception Ex) { EventLog.WriteEntry(Ex.Message.ToString(), "", EventLogEntryType.Error); } } public void PopulateList() { SPWeb objWeb = SPControl.GetContextSite(Context).RootWeb; try { TreeNode nodeRoot = null; tvListnLib.Nodes.Clear(); if ((objWeb.Exists) && (objWeb.Title != null) && (objWeb.Url != null)) { nodeRoot = new TreeNode(objWeb.Title); tvListnLib.NodeStyle.CssClass = "ms-input"; tvListnLib.Nodes.Add(nodeRoot); nodeRoot.NavigateUrl = objWeb.Url + "/default.aspx"; FillWeb(objWeb, nodeRoot); SPListCollection lstColForCurrSite = objWeb.GetListsOfType(SPBaseType.GenericList); FillList(lstColForCurrSite, nodeRoot, "List"); SPListCollection DLColForCurrSite = objWeb.GetListsOfType(SPBaseType.DocumentLibrary); FillList(DLColForCurrSite, nodeRoot, "Document Library"); } } catch (Exception Ex) { EventLog.WriteEntry(Ex.Message.ToString(), "", EventLogEntryType.Error); } } public void FillWeb(SPWeb webCurr, TreeNode objTreeNode) { SPListCollection lstColForCurrSite = null; SPListCollection DLColForCurrSite = null; try { foreach (SPWeb objWeb in webCurr.GetSubwebsForCurrentUser()) { TreeNode newTreeNode = null; try { if (objWeb.Exists) { newTreeNode = new TreeNode(objWeb.Title); objWeb.Lists.ListsForCurrentUser = true; objTreeNode.ChildNodes.Add(newTreeNode); newTreeNode.NavigateUrl = objWeb.ServerRelativeUrl+"/default.aspx"; newTreeNode.CollapseAll(); lstColForCurrSite = objWeb.GetListsOfType(SPBaseType.GenericList); FillList(lstColForCurrSite, newTreeNode, "List"); DLColForCurrSite = objWeb.GetListsOfType(SPBaseType.DocumentLibrary); FillList(DLColForCurrSite, newTreeNode, "Document Library"); } } catch (Exception Ex) { EventLog.WriteEntry(Ex.Message.ToString(), "", EventLogEntryType.Error); } FillWeb(objWeb, newTreeNode); //call recurcive function for all subsite. } } catch (Exception Ex) { EventLog.WriteEntry(Ex.Message.ToString(), "", EventLogEntryType.Error); } finally { if (webCurr != null) webCurr.Dispose(); } } public void FillList(SPListCollection lstColCurrWeb, TreeNode newTreeNode, string Type) { try { int lstCount = 0; SPList lstNode; TreeNode ListNode = new TreeNode(Type); newTreeNode.ChildNodes.Add(ListNode); if (Type == "List") ListNode.NavigateUrl = lstColCurrWeb.Web.Url + "/_layouts/viewlsts.aspx?BaseType=0"; else ListNode.NavigateUrl = lstColCurrWeb.Web.Url + "/_layouts/viewlsts.aspx?BaseType=1"; TreeNode tnNewList = null; for (lstCount = 0; lstCount < lstColCurrWeb.Count; lstCount++) { lstNode = lstColCurrWeb[lstCount]; tnNewList = new TreeNode(lstNode.Title, lstNode.ParentWebUrl); ListNode.ChildNodes.Add(tnNewList); tnNewList.NavigateUrl = lstNode.DefaultViewUrl; tnNewList.CollapseAll(); } } catch (Exception Ex) { EventLog.WriteEntry(Ex.Message.ToString(), "", EventLogEntryType.Error); } } } }