tag:blogger.com,1999:blog-691739770978360344.post1521524233485960484..comments2023-03-16T02:22:53.208-07:00Comments on KWizCom SharePoint Blog: How do I tell what the next list item ID is?Igor Goldshtaubhttp://www.blogger.com/profile/11454162751899721014noreply@blogger.comBlogger5125tag:blogger.com,1999:blog-691739770978360344.post-70126736577060069672014-10-30T10:38:04.800-07:002014-10-30T10:38:04.800-07:00Hey Paul, I'm afraid that's not accurate.
...Hey Paul, I'm afraid that's not accurate.<br /><br />First off, the created date is not indexed, so querying and sorting based on it on large lists is an issue.<br /><br />Now, if you delete an item - it's ID won't be re-used again, so it will be skipped - in which case you will get the wrong item ID.<br /><br />Also, if you import, restore from recycle bin, or add items using a feature - their IDs might not be the last one, and in some cases they will be the latest one created.<br /><br />This is why we didn't end up using that. I agree it is a very simplistic solution but it is not very solid or guaranteed.Shai Petelhttps://www.blogger.com/profile/15299015261603781984noreply@blogger.comtag:blogger.com,1999:blog-691739770978360344.post-54975955299159868022014-10-28T21:26:32.459-07:002014-10-28T21:26:32.459-07:00Did you ever consider grabbing the list item with ...Did you ever consider grabbing the list item with the most recent Created date and adding one to its ID?<br /><br />That should gracefully handle the issue of deleted items and also be usable via client-side scripting.<br /><br />On very busy lists, however, there's still the possibility of concurrency with other users.Tripwirehttps://www.blogger.com/profile/12664618733681351513noreply@blogger.comtag:blogger.com,1999:blog-691739770978360344.post-67757750788382682942013-08-06T07:22:57.707-07:002013-08-06T07:22:57.707-07:00Hi Murugesa,
This post is 4 years old, this SQL co...Hi Murugesa,<br />This post is 4 years old, this SQL command is not even available in SP2010 or SP2013, it was only there for SP2003/SP2007, and back then running this read only query was considered OK ( I have personally confirmed it back then with MS at that time ).<br /><br />In any case this is sooo outdated you can't even use it now - but yes, you are correct developers should not access the content data base.<br /><br />Sorry I did not understand your comment about SQL credential. In this code Roi was using RunWithElevatedPrivileges to get higher level access.Shai Petelhttps://www.blogger.com/profile/15299015261603781984noreply@blogger.comtag:blogger.com,1999:blog-691739770978360344.post-48243716517494248062013-08-06T06:50:47.780-07:002013-08-06T06:50:47.780-07:00As a best practice policy defined by Microsoft,you...As a best practice policy defined by Microsoft,you cannot get things done through this approach as you are directly dealing with content database.If you are managed to get SQL credential for the production,then good to go.Murugesa Pandianhttps://www.blogger.com/profile/14221230115251601531noreply@blogger.comtag:blogger.com,1999:blog-691739770978360344.post-64869231052729885872013-08-06T06:47:38.816-07:002013-08-06T06:47:38.816-07:00You are intended to give the solution anyhow.But A...You are intended to give the solution anyhow.But As we are developer often forget to follow the "Best Practices" for SharePoint as it goes "You can't not directly / or indirectly(through code) deal the Content Databases.<br />If you are manage to get the SQL credentials on your production server,then it good to go.<br />Murugesa Pandianhttps://www.blogger.com/profile/14221230115251601531noreply@blogger.com