I am working on a solution where I have a list with a column named LogIDNumber. For each new entry in the list, I would like to increment the LogIDNumber by one. I could use the ID generated by SharePoint, but for this solution it needs to be independent. I was thinking of using an event receiver, but the problem I am having trouble with is getting the value from the previous entry.
I can use something like this example to gain access to the list items, but I'm not sure how to proceed after that.
using (SPSite siteCol = new SPSite("http://server/sites/Contoso"))
{
using (SPWeb web = siteCol.RootWeb)
{
SPList list = web.GetList("/sites/Contoso/Lists/Books");
SPListItemCollection items = list.GetItems("Title", "LogIDNumber",);
}
}
Is there a way to grab the last value?