Share via


How to reiterate/reset the ID column of a list in Sharepoint?

Question

Thursday, April 5, 2018 12:06 PM

I'm pretty new in sharepoint so please bare with me. 

I have a list where i have an ID column for each item row. Whenever I add a new item, the ID column increments with 1. (e.g. previous item is 112, then the new row will have an ID of 113.) But whenever I delete an item or row and then add another item/ row, the ID column will now skip the deleted row. (e.g. 113 is deleted, then the added row will have an ID of 114) 

Is there a way to prevent the ID column from skipping the deleted IDs? I mean is there a way that if the user deletes a row e.g. 113, the next added row would still be 113 instead of 114? Thanks in advance guys!

All replies (6)

Thursday, April 5, 2018 5:01 PM

Not possible in my knowledge...However you can try creating another Numeric column and update it by making user of an workflow and treat it as ID column. Build logic in workflow to pull previous value and update existing item accordingly.

Thanks,

Mukesh


Thursday, April 5, 2018 6:40 PM | 1 vote

By Using SQL we can reset ID column numbering, But this is not commanded

SELECT * FROM [ContentDB Name].[dbo].[AllListsAux] where ListID=’GUID of List'  

Output-

**SELECT * FROM [WSS_Content].[dbo].[AllListsAux] where ListID='XXXXXXX-XXXX-XXXX-XXXXXXXX'  
**

**Note- **You can get the List GUID by right clicking ‘Audience targeting settings’ from List settings.

Link address will look, as given below. Within the curly braces, you have the list GUID.

Let’s go to the implementation part of resetting the list item ID.

Ref Link - https://www.c-sharpcorner.com/article/restart-list-item-id-numbering-in-sharepoint-server-2016/

Please remember to mark your question as answered &Vote helpful,if this solves/helps your problem. ****************************************************************************************** Thanks

RV

 


Thursday, April 5, 2018 11:34 PM

HI,

Short answer is NO . ID is a unique value column, SP keep tracking the last assigned item iD and increment it by one on adding new item, so you cannot reuse the IDs of the deleted items.if you want to re-use the id of a deleted item , then you will need to restore item from the recycle bin (if it still exists) and update  it's value.

BUT, if you want to do it anyway, you can follow what maximus_2085 have mentioned above. Create custom column and update it's value using event receiver or workflow .

for more information , please have a look on the following similar threads 

Does SharePoint reassign the Deleted Item ID  
https://social.technet.microsoft.com/Forums/en-US/292e9b05-4e11-4961-a5d2-cb67dd45d330/does-sharepoint-reassign-the-deleted-item-id?forum=sharepointgenerallegacy

Create item in SharePoint list with existing/old ID.  
https://social.msdn.microsoft.com/Forums/office/en-US/a7008661-79ff-4d54-8d22-5b8262d8d677/create-item-in-sharepoint-list-with-existingold-id?forum=sharepointdevelopmentprevious

Hope this help you

Best Regrads, Ahmed Madany MCTS @twitter http://twitter.com/ahmed_madany @Blog http://ahmedmadany.wordpress.com @LinkedIn http://eg.linkedin.com/pub/ahmed-madany/35/80/2b6


Friday, April 6, 2018 7:34 AM

Hi jaybeeou,

ID is a by design column in SharePoint. Microsoft doesn’t recommend you delete the item by deleting row of SQL table.

Suppose you delete a list item in UI, the list item is not deleted completely. The deleted item is moved to first level recycle bin and will be moved to second level recycle bin if you remove it from first level recycle bin. Users and site administrators can restore deleted items from recycle bin if you need to.

Thus, the item is still in SharePoint even if you remove it from list. It’s not recommended to change the by design behavior, which would cause security issues.

More introduction about SharePoint recycle bins for your reference:

https://support.office.com/en-us/article/restore-deleted-items-from-the-site-collection-recycle-bin-5fa924ee-16d7-487b-9a0a-021b9062d14b

Best Regards,

Dean Wang

Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact [email protected].


Click here to learn more. Visit the dedicated forum to share, explore and talk to experts about Microsoft Teams.


Thursday, April 19, 2018 12:11 PM

Hi jaybeeou,

Is there any update?

If my reply is helpful to you, you can mark as answer.

Best Regards,

Dean Wang

Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact [email protected].


Click here to learn more. Visit the dedicated forum to share, explore and talk to experts about Microsoft Teams.


Monday, June 3, 2019 1:41 PM

Hi Team,

In addition to above thread, I have a Sharepoint list where we are creating Sites Using ID's of the list as it was unique.

Unfortunately few months back one item got deleted from Sharepoint list and we are not able to found in First and Second stage of recycle bins.

So now the ask was to restore the Item which was deleted (OR) create an item with Same ID which will resolves my issue?

Does any one has any idea please respond

Thanks for the Help in Advance :)

ch.Pavankumar