Skip to main content
1 of 4
Dikesh Gandhi
  • 7.2k
  • 4
  • 31
  • 58

Put this below code in List A event receiver

Code:

public override void ItemAdded(SPItemEventProperties properties)
    {
        base.ItemAdded(properties);

        using (SPSite site = new SPSite("http://MyWeb/sites/mysite/"))
        {
            using (SPWeb web = site.OpenWeb())
            {                
                SPList desList = web.Lists.TryGetList("B");
                if (desList != null)
                {
                    SPListItem desItem = desList.Items.Add();
                    foreach (SPField field in properties.item.Fields)
                    {
                        if (!field.ReadOnlyField && !field.Hidden && field.InternalName != "Attachments")
                        {
                            if (desItem.Fields.ContainsField(field.InternalName))
                            {
                                desItem[field.InternalName] = sourceItem[field.InternalName];

                            }

                        }
                    }
                    desItem.Update();
                }
            }
        }

    }

This method will copy the list item from List A to List B after you add list item to List A.

Hope this will help you!

Dikesh Gandhi
  • 7.2k
  • 4
  • 31
  • 58