JL.
JL.

Reputation: 81342

SharePoint programatically move one list item to another, is it possible?

I have 2 SharePoint lists that have identical structures. Is it possible for me to move just 1 list item in the first list to the other, without recreating the list item and deleting it? This way the operation can occur in one transaction.

Upvotes: 2

Views: 1469

Answers (1)

Driss Zouak
Driss Zouak

Reputation: 2401

SharePoint's lists are not really relational data, and therefore the idea of doing something as a real transaction isn't possible, i.e. with automatic rollback, etc.

If I understand you correctly you are trying to effectively 'reassign' the item from one list to another, and I don't believe that that is possible in any way. We've done data extra and import, but that always does effectively recreates the item.

One of the things that often trip people up is equating SharePoint lists to database tables, and assume that they can be treated and manipulated as such. Unfortunately they aren't, at least not yet.

A strategy I have used to move data over time from an "old list" to a "new list" is to add an event handler for any Add, Delete or Update on the list. Whenever those were triggered we would update the entries in the new table, and when the cut over date arrived whatever entries had not already been moved over we would examine to determine 1. are they really needed? are they used? and 2. the best way to move them over.

Hope that helps

Upvotes: 3

Related Questions