c# - How to create event receivers programatically? -


we creating content databases, site collections , libraries programatically. uploading documents in document library. want create event receivers programatically in c# (without using visual studio) list created progrmatically ? want activate them programatically. there way ? can please provide me code or link through step step guide ?

if can use event receiver template in visual studio , define c# code required event might solve purpose. itemadded event receiver did simple this:

    public override void itemadded(spitemeventproperties properties)     {         if (properties.listtitle.equals("cl2"))         {             using (spsite site = properties.opensite())             {                 using (spweb web = site.rootweb)                 {                     string sytr = web.url.tostring();                     string s = web.portalurl.tostring();                     string sq = web.serverrelativeurl.tostring();                     string str = site.url.tostring();                     splistitem _currentitem = properties.listitem;                     citem["title"] = "test";                     citem.update();                     base.itemadded(properties);                 }             }         }     } 

Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -