Is there a way to get the last ID from a Document Library with javascript/jquery?
|
|
There was a similar question in SharePoint Stackexchange. I even wrote a blog post about retrieving the last item in a list/library: Three ways to get the id of last created SPListItem. There I show the last item for current user... If you want to retrieve the very last document, it is much easier. I prefer the Client object model. But it can be done with SPServices and listdata.svc. Here is the code:
It is important to ignore folders, otherwise you'll get a latest folder, not the latest document. If OData is preferred (listdata.svc) you can use it as well:
|
|||||||||
|
|
SPServices has a function called GetLastItemId you can use. Here is the documentation for that function: $().SPservices.GetLastItemId |
|||||
|
|
I think you need some thing like this - Create the soap envelope
"; then ajax call -
and in the ProcessListItems you can easily retrieve the value
or alternatively you can simply bring all rows all columns, get the first one and retrieve value, in that case ommit viewFields and rowLimit I assumed you meant last modified by 'Last' ID, in case anything else please edit the query portion Please note this is not a tested code, this is just one sample written instantly, please re-write this as per ur requirement |
|||||
|