Creating & Adding Eventhandler to Sharepoint Doc Library
Adding Events & Registering Events:
http://farhanfaiz.wordpress.com/2007/12/31/creating-adding-an-event-handler/
http://support.microsoft.com/kb/939307/en-us
Create Multiple Contents for Document Library:
If you want to get Multiple Templates under Document Library "New" create custom content types for Share point document library. The following URL explains how to create Custom Content with Template.
http://grumpywookie.wordpress.com/2008/08/26/microsoft-word-template-dotx-sharepoint-contenttype/
Create Custom Content Document Templates:
http://platinumdogs.wordpress.com/2010/01/15/provision-a-content-type-with-a-document-template-using-a-feature-part-1/
http://platinumdogs.wordpress.com/2010/01/15/provision-a-content-type-with-a-document-template-using-a-feature-%e2%80%93-part-2/
http://farhanfaiz.wordpress.com/2007/12/31/creating-adding-an-event-handler/
Get Available Events for Sharepoint Library:
static void GetEvent()
{
using (SPSite site = new SPSite("http://moss2003/"))
{
using (SPWeb web = site.OpenWeb())
{
SPDocumentLibrary doc = (SPDocumentLibrary)web.GetList("Shared Documents");
foreach (SPEventReceiverDefinition def in doc.EventReceivers)
{
Console.WriteLine("Name:{0}",def.Name);
}
}
}
}
{
using (SPSite site = new SPSite("http://moss2003/"))
{
using (SPWeb web = site.OpenWeb())
{
SPDocumentLibrary doc = (SPDocumentLibrary)web.GetList("Shared Documents");
foreach (SPEventReceiverDefinition def in doc.EventReceivers)
{
Console.WriteLine("Name:{0}",def.Name);
}
}
}
}
Work Around for Updating Event Fires Twice:
http://support.microsoft.com/kb/939307/en-us
if (properties.AfterProperties["vti_sourcecontrolcheckedoutby"] == null && properties.BeforeProperties["vti_sourcecontrolcheckedoutby"] != null) { //This is when the update event is triggered by check-in. } else { //This is triggered by events other than check-in action. }
Create Multiple Contents for Document Library:
If you want to get Multiple Templates under Document Library "New" create custom content types for Share point document library. The following URL explains how to create Custom Content with Template.
http://grumpywookie.wordpress.com/2008/08/26/microsoft-word-template-dotx-sharepoint-contenttype/
Create Custom Content Document Templates:
http://platinumdogs.wordpress.com/2010/01/15/provision-a-content-type-with-a-document-template-using-a-feature-part-1/
http://platinumdogs.wordpress.com/2010/01/15/provision-a-content-type-with-a-document-template-using-a-feature-%e2%80%93-part-2/
Comments