tags:

views:

17

answers:

1

I want to increment the metadata whenever the copy operation is trigerred.

       public override void ItemAdded(SPItemEventProperties properties)
        {           
            try
            {   
                this.DisableEventFiring();
                SPSecurity.RunWithElevatedPrivileges(delegate()
                {
                string oid = string.Empty;                        
                using (SPWeb web = properties.OpenWeb())
                {
                     SPList list = web.Lists[properties.ListId];
                     SPListItem item = list.Items[properties.ListItem.UniqueId];      
                     String Source=item.CopySource.toString();
                 }
              });
          }
Catch()

Here Item>copysource returns empty string So it's difficult for me to check wheter the event has fired due to copy operation

A: 

You don't need the RunWithElevatedPrivileges, because ItemAdded event already runs with as privileged user.

Janis Veinbergs
Hi Janis Veinbergs, I Have done it without using RunWithElevatedPrivileges, but my issue is that item.copysource returns an empty string. So how can i verfiy that it is due to copy operation
Preetam Patil