Can any one please suggest me how to "archive" the list items (say "related to 2015 year") that are listed in SharePoint. "Archive" means I should indicate that these forms are relate to 2015 year.
4 Answers
It depends what you mean by "archiving". You can move items to another list, or you can just filter them from the view.
Use a list column to hold a value, e.g. a status text or a year number. Then create views that exclude that value.
-
1This is the best solution if your list item count is expected to be less than 5000. It uses out of the box features which are the easiest to maintain over the long term. If you expect more than 5000, look into using Information management policy settings instead of custom development. Commented Jan 9, 2018 at 9:00
You can create workflow which can move the items from Main List to archive list.Here are the steps to create a workflow for archiving purpose.
Archive SharePoint List Items in SP 2010 and 2013
Or You can think about writing a custom timer job which will move the items from main list to archive list.
Or Use the save as template options, Save the Main list as template and create a new list using that template. After that delete the all the items which you dont want in the new list.
If you're worried about having too many archived lists cluttering up your Site Contents, it may also be possible to export the list to Excel, combine the items from previous years into separate sheets (or all into one with the ID's updated), and re-upload the Excel file into a SharePoint archive document library.
I think SharePoint also crawls through the contents of files so that they'll show up in the search bar, but I'm not quite sure if it works at a level higher than the document library/list search bar.
If you don't need to restore the archived data (list items) in SharePoint and need archiving purely to comply company's data retention or other compliancy policy look at the 3-rd party tool called Listman.io.
Depending on your requirements it could auto archive list items once per day based on some filtering criteria, download attachments, delete/modify affected items and optionally process the resulted CSV file (for example import the archived data into MS SQL Server or Azure SQL using BCP
utility) with no code required. There is an example of the config file that will implement the before mentioned scenario:
{
connectTo: {
appKey: "listman-******-io",
siteUrl:"https://listman.sharepoint.com/",
clientId: "fe26fe8a-60b9-4523-996e-****",
clientSecret: "mVhELni3mB5n5moBeav4e9sKpq+s1ylV+vU0MFyWjAI="
},
archiveJobs: [
{
list: "Customers",
exportColumns: ["Name", "Email", "Phone", "Address", "Archived"],
filterRecordsBy: {
columnName: "Archived",
equalBool: false
},
exportAttachments: true,
onRecordProcessed:{
remove: true
},
archiveTo: {
csvFile: "C:\\Export\\Customers\\customers.csv",
csvAttachmentsFile: "C:\\Export\\Customers\\customers_attachments.csv",
attachmentsFolder: "C:\\Export\\Customers\\attachments",
addHeader: true,
append: false
},
schedule: {
runImmediate: false,
runUsingCron: "0 0 12 1/1 * ? *"
},
onSuccess: {
runProcess: "C:\\Tools\\csvToSql.bat",
},
}
]
}
where C:\Tools\csvToSql.bat
file is:
bcp my_database.customers_table in C:\Export\Customers\customers.csv -t, -U listman_user
ren C:\Export\Customers\customers.csv customers_%date:~10,4%%date:~7,2%%date:~4,2%_%time:~0,2%%time:~3,2%.csv
P.S. I'm a developer of the app.