Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Automatically copy list data from one list to another list after 1 month

I have list that having data stores dynamically once the infopath form has been submitted. I want to archive this data after 30 days of creation date of any data. can you please suggest how would i do this. see i can do this by workflow but how can i set the condition that once 30 days complete after creation of any list it will automatically copy into other list.

like image 900
Vivek Jagga Avatar asked Dec 22 '10 10:12

Vivek Jagga


People also ask

How do I transfer data from one SharePoint list to another using Power Automate?

To add this flow action, go to Next step -> search for Get items (under SharePoint) in the search bar > click on that. Here select the SharePoint Site Address and then the List Name. Here choose the SharePoint Souce list from where you want to copy the list items.

How do I copy items from one SharePoint list to another?

On the home page, add a new list by clicking the “New” button on the menu and selecting the “List” option. Then, select the option to create a list from an existing list. Simply select the site and the specific list you want to copy and click the “Next” button. You will then have to enter the name for the list.


5 Answers

First I would want to question WHY you want to move it to another list?

Why not simply setup a view on your main list showing only records created in last 30 days :-

Created >= [Today]-30

(And yes, you can use Today in view filters)

like image 188
Ryan Avatar answered Oct 12 '22 13:10

Ryan


The best way to proceed is to create a timer job and define the criteria (like when should it be running) while creating the job. We have a very helpful post by SharePoint MVP here on how to create custom jobs. Note, you can test the job and business logic for shorter duration and if it works fine, you can simply extend the job duration for 30 days.

Its very simple, all you have to do is to define your 'copying list' logic in the Execute method of job class. Good luck

like image 30
code master Avatar answered Oct 12 '22 14:10

code master


I believe you can simply use standard out-of-the-box workflow activities to do this - no need for timer jobs or console apps.

Using SharePoint Designer, create a new workflow (New -> SP Content -> Workflow). Specify the list to attach the workflow to.

Specify that the workflow should start on item creation only.

In the first Step, add an action: Pause for duration. Make the duration 30 days.

Add another action: Copy list item. Specify the list to copy to.

Optionally: create a third action: Delete list item if you want the original item to be deleted from the original list.

And I think that's it :)

like image 34
James Allen Avatar answered Oct 12 '22 14:10

James Allen


you have to crate a timer job which runs daily and move the items which are one month old

like image 34
Ashutosh Singh-MVP SharePoint Avatar answered Oct 12 '22 12:10

Ashutosh Singh-MVP SharePoint


Potentially the easiest solution is to create a console application that you schedule to run on the SharePoint server (an alternative to creating a timer job).

Depending on how you want to archive the data, you could:

  • Get the list items (probably using GetItems), save them to a file or a DB, and delete the old items
  • Use custom STSADM commands to export the list (backup just the list)
  • Backup the entire site using STSADM
like image 38
Kit Menke Avatar answered Oct 12 '22 12:10

Kit Menke