Answered by:
copy List from one to another site collection using Event Receiver

Question
-
Hi,
I have a site collection A and List A1 inside it and Site collection B and List B1 inside it.
Whenever a new item is addedin A1 , I want the same to be available in B1 and the same for updation as well.
How can I acheive this?
Regards, Shreyas R S
- Edited by sosh2785 Tuesday, May 5, 2015 11:26 AM
Monday, April 27, 2015 12:28 PM
Answers
-
Hi,
According to your description, my understanding is that you want to copy list items from one site collection.
If you don't want to do it without deploying, you can use rest api to copy list items from one site collection to another one, then you can use workflow to trigger the rest api when the source item created.
Here are some detailede code demos for your reference:
Copy List items using REST/JSON
CALLING THE SHAREPOINT 2013 REST API FROM A SHAREPOINT DESIGNER WORKFLOW
Thanks
Best Regards
TechNet Community Support
Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact tnmff@microsoft.com.Saturday, May 2, 2015 9:13 AM
All replies
-
Hi Shreyas,
you can do that with SharePoint Designer workflow, so install sharepoint designer 2013, then open site and create workflow that starts when item is created but u need to select SharePoint 2010 as platform as copy action available with 2010 platform not 2013 (still will work with 2013 sites)
check this thread
also check the following
http://www.fivenumber.com/copy-item-from-one-list-to-another-using-sharepoint-designer-workflow/
Kind Regards,
John Naguib
Senior Consultant
John Naguib Blog John Naguib TwitterPlease remember to mark this as answered if it helped you
- Proposed as answer by romeo donca Monday, April 27, 2015 12:58 PM
- Unproposed as answer by sosh2785 Monday, April 27, 2015 1:00 PM
Monday, April 27, 2015 12:55 PM -
Hi John,
I need to copy between 2 site collections. Above solutions helps when both the lists are in same site collection.
Regards, Shreyas R S
Monday, April 27, 2015 12:57 PM -
Hi
i think this feature is not available OOB (from one site collection to another), you may look for writing Event Receivers.
Thanks,
DannyPlease mark as answer if it helps.
Monday, April 27, 2015 1:04 PM -
Hi Danny,
Thanks for the reply. Is there any detailed step by steps or any post Where I can get code for Event Receivers.
Regards, Shreyas R S
Monday, April 27, 2015 1:10 PM -
Hi
you can check these links for step by step process-
http://onceinawhilescribble.blogspot.in/2013/05/creating-simple-event-receiver-in.html
https://msdn.microsoft.com/en-us/library/ee231563.aspx?f=255&MSPPError=-2147217396
http://www.sharepointpals.com/post/How-to-create-a-custom-list-level-event-receiver-in-SharePoint-2013-and-SharePoint-2010
Thanks,
Danny
Please mark as answer if it helps.
Monday, April 27, 2015 1:13 PM -
Hi
1. create a powershell script which will copy the item
this is an example
http://adicodes.com/copy-or-replace-list-items-in-powershell/
2. create an event list, and attach it to your list ( main list )
http://www.sharepointpals.com/post/How-to-create-a-custom-list-level-event-receiver-in-SharePoint-2013-and-SharePoint-2010
2a. Start the powershell from event receiver
https://social.msdn.microsoft.com/Forums/en-US/ecffa2e7-3962-49d4-81db-b4b9e8964a9e/run-powershell-script-from-a-event-receiver?forum=sharepointdevelopmentprevious
Romeo Donca, Orange Romania (MCSE, MCITP, CCNA) Please Mark As Answer if my post solves your problem or Vote As Helpful if the post has been helpful for you.
- Proposed as answer by John NaguibMVP Monday, April 27, 2015 2:17 PM
Monday, April 27, 2015 1:19 PM -
Hi Romeo Donca,
Your solution seems to be helpful.... But I don't think I can run the powershell scripts on the servers. My cliant SP admins may not allow it
Regards, Shreyas R S
Monday, April 27, 2015 1:28 PM -
are u allowed to deploy code to server?
Kind Regards,
John Naguib
Senior Consultant
John Naguib Blog John Naguib TwitterPlease remember to mark this as answered if it helped you
Monday, April 27, 2015 2:17 PM -
Hi John, Yes I can send solution and get it deployed. Is there a way to do without deploying? Work flow using Restapi calls?
Regards, Shreyas R S
Tuesday, April 28, 2015 2:01 AM -
Hi,
According to your description, my understanding is that you want to copy list items from one site collection.
If you don't want to do it without deploying, you can use rest api to copy list items from one site collection to another one, then you can use workflow to trigger the rest api when the source item created.
Here are some detailede code demos for your reference:
Copy List items using REST/JSON
CALLING THE SHAREPOINT 2013 REST API FROM A SHAREPOINT DESIGNER WORKFLOW
Thanks
Best Regards
TechNet Community Support
Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact tnmff@microsoft.com.Saturday, May 2, 2015 9:13 AM