c# - How to get the ID of the new inserted row in the SharePoint list by using web service -


i inserting new list items in share point list using web service using below code.

 servicereference.datacontext sc = new servicereference.datacontext(new uri("http://servername:portnumber/_vti_bin/listdata.svc"));  sc.credentials = new system.net.networkcredential(spusername, sppassword, spdomain);  sc.addtosamplelist(new servicereference.samplelist                             {                                 title= "hello world"                                                                                             }); sc.savechanges(); 

its working fine..

i need id of new inserted row..

is there anyway id of newly inserted row in costume web part

  splist splist = spweb.lists["samplelist"];   splistitem splistitem = splist.items.add();   splistitem["title"] = "hello world";   splistitem.update();   int id=splistitem.id;//like 

any or suggestions please..

thanks in advance...

you going have change web service, return integer, id of new inserted record. savechanges() need return int. when this, need update service reference.


Comments

Popular posts from this blog

jQuery Mobile app not scrolling in Firefox -

c++ - How to add Crypto++ library to Qt project -

php array slice every 2th rule -