I have seen a lot of questions asking how to get the latest ID in a SharePoint list, but all answers suggest simply querying the last item and using its ID as maximum ID. However, the problem with this method is that if the latest item was deleted from that list then you will not be able to get the correct ID because you will be querying the penultimate item, which does not have the latest ID.

I need to redirect the user from a newifs page to an editifs page after an item is created using SPServices, which needs an ID in the URL. The only solution I was able to come up with is to create a dummy item in that list before creating, get the ID of the dummy item, delete it and then add 2 to it to get the ID I want. This is very hacky but I haven't managed to figure out any other way of doing this. Are there any real solutions to this problem? Thank you.


The only way to get the nextAvailable id is by hitting content database:

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

enter image description here

|improve this answer|||||
  • That's a shame if that's the only way as I don't have access to the SQL database nor SP Designer. – LaDuelo Nov 27 '17 at 13:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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