Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

How can i copy an item from one list to another list,I want to archive this item after 365 days of modified date of any item in the list.this i have to be do with Custom Timer job. can you please suggest how would i do this.

share|improve this question
    
I do have the same Requirement. i tried Like this but still unable to acheive the same. Canyou please help me on this –  sandy_9866141457 Jun 3 '13 at 6:45

3 Answers 3

I suggest you to use google...
http://www.codeproject.com/Tips/634208/Create-and-Deploy-Custom-Timer-Job-Definition-in-S

Basically make a TimerJob in Visualstudio, write your code there and let this job run once a day.

Code:

  1. get list
  2. check if an item hasn't been modified since 365 days.
  3. move to other list
share|improve this answer

Look into information management policies. That is what they are designed to accomplish.

share|improve this answer
    
iam using sharepoint foundation 2010,as i know that there was no option of Information management policies in foundation..can u suggest through custom timer jobs –  Naresh Aug 23 '12 at 5:01

@Gwny have an pretty good answer but you could also manage it with Powershell.

"PowerShell: This is the best option when it comes to copying list in your SharePoint site. Here is what you need to do."

Get an instance of the SharePoint Site Collection using SharePoint SPSite object. Open the root web. Save the list that you want to copy as a template using SaveAsTemplate method of SPList. Get a reference to the list template that is created. Add a list using SPListCollection.Add Method (String, String, SPListTemplate). When successful, this method will display the list GUID. Update the root web using SPWeb.Update

The code below only copy the list, if you want to achieve only the items you have to check each item in the list.

#//Replace the URL with your real site collection URL
$siteURL = "http://sitecollectionURL"
#//Replace the list title with your list title in site collection
$sourceListTitle = "My List Title"
$targetListTitle = "My Target List Title"

$site = New-Object Microsoft.SharePoint.SPSite($siteURL)
$web = $site.OpenWeb()
$sourceList = $web.Lists[$sourceListTitle]
$sourceList.SaveAsTemplate($sourceListTitle,$sourceListTitle,$true)
$listTemplate = $site.GetCustomListTemplates($web)[$sourceListTitle]
$web.Lists.Add($targetListTitle, $targetListTitle, $listTemplate

Then set the Scheduled task to run each 365 day.

http://www.naumanahmed.com/2012/02/sharepoint-2010-how-to-copy-list-within.html

http://sergioblogs.blog.co.uk/2013/01/08/so-i-had-an-issue-at-work-where-i-needed-15407471/page/2/

share|improve this answer
1  
Do you mean "Scheduled task" for triggering it? –  Robert Lindgren Aug 8 at 12:40
    
thats correct, I'll edit my answer –  Plexus81 Aug 8 at 12:43

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.