SharePoint 2016, 2013 , 2010 , 2007 Create list item with existing ID

Hey Guys,

Now i was in a really tricky scenario where a master record had been deleted by someone which was referenced using code in numerous places. Changing the code would be a nightmare.
Now the easiest solution which will come to everyones mind is to add the list item with those possible values again. But it would not retain the ID value which was used in the code.Let me give you an example to clarify the problem statement

PROBLEM STATEMENT
There is a “status” master list with the following values and the third list item is deleted.
We want the 3rd list item with ID=3 to be restored even when it is deleted from recycle bin as in the code the ID column is used to reference the status.

Status
ID
Approved
1
Rejected
2
Review
3
In Draft
4

SOLUTION:
Now usually the answers would be

  1.   Restore it from recycle bin (almost 3 months have passed and it has been deleted from recycle bin as well)
  2.   Delete the list and recreate the list with fresh entries (Break referential integrity of lists where the column from this list is looked up i.e lookup )
  3. It cannot be done.ID is auto increment column (Sad to head but its true)

So, last option would be to change the code L
This would result in enormous effort of code changing.
But wait if even you face similar scenario and have lesser amount of records (say 10-15 records) which have to be recovered then there is a savior
SITE MANAGER
Follow below steps to recover your item

  1. Create a replica of the list where the item is to be recovered
  2. Add all the items in the order required.
  3.   Navigate to site manager using below url
  4. http://<web level url>/_layouts/sitemanager.aspx
  5. Select the replica list in left navigation then list items will appear in right pane.
  6. Select the list item from replica list and select Actions >> Copy

  7.  Then in the copy dialog select the original list where the item was deleted.
  8.   Done


Note: This method can be used only when the item is deleted from recycle bin as well.If the item of same is present in recycle then it would not recreate with same ID.

Comments

Post a Comment

Popular posts from this blog

Install Node.js without admin rights

Create a lean React Solution using Typescript

Replace all occurence of String in JavaScript