Get column values of item in ItemAdding event handler

In an Item Adding event handler Properties.ListItem will be null. Same is the case with Properties.BeforeProperties & Properties.AfterProperties too. So how to get the values entered in the NewForm.aspx in the ItemAdding method. Here we go.. You can access the value using AfterProperties property. But here you have to pass the internal name of the... Continue Reading →


Resizing an Image while adding as an attachment to a list Item

Event handler code to resize an an image when added as an attachment to a list item.public override void ItemAdded(SPItemEventProperties properties){     if (String.Compare(properties.ListTitle, "Brief Participant Details", true) == 0)    {         SPSite siteColl = new SPSite(properties.SiteId);         SPWeb site = siteColl.OpenWeb(properties.RelativeWebUrl);         SPList listCFPrint = site.Lists[properties.ListTitle];          ResizeImage resize = new ResizeImage();         if (properties.ListItem.Attachments.Count > 0)        {              string fileName... Continue Reading →

TemplateID for different sharepoint lists

If you want to create an event handler for a list in sharepoint you need the template Id of that particular list. Here are the list of Id'sGenericList 100DocumentLibrary 101Survey 102Links 103Announcements 104Contacts 105Events 106Tasks 107DiscussionBoard 108PictureLibrary 109DataSources 110WebTemplateCatalog 111UserInformation 112WebPartCatalog 113ListTemplateCatalog 114XMLForm 115MasterPageCatalog 116NoCodeWorkflows 117WorkflowProcess 118WebPageLibrary 119CustomGrid 120DataConnectionLibrary 130WorkflowHistory 140GanttTasks 150Meetings 200Agenda 201MeetingUser 202Decision... Continue Reading →

Customized error page in Sharepoint

In SharePoint there is not any functionality for displaying our customized error page.Like if for data validation in event/item handler we useproperties.ErrorMessage = “Opps... Not allowed”;properties.Cancel = true;And validation message displayed in SharePoint error Page which looks error in application.But with this Context you can use to redirect to any of your custom or any... Continue Reading →

Create a website or blog at

Up ↑

%d bloggers like this: