Skip to main content

Posts

Showing posts with the label Event handler

Event handler to copy items from one site to another

The code can be used to copy items from one site to another ,but source and destination sites must be in same server. If the item was added newly in a Document Library , Item Checked In Event Handler must be used :    public override void ItemCheckedIn(SPItemEventProperties properties)        {            base.ItemCheckedIn(properties);            try            {                SPSite sourceSite = new SPSite("Source Site URL");                SPWeb sourceweb = sourceSite.OpenWeb();                SPList sourcelist = sourceweb.Lists["Source List"];    ...