How can I add a new list item in side an existing folder in the list using the OOB SharePoint Lists.asmx web service?
I finally found out the solution:
By using the following batch element you can create an item inside a folder in a list or library
<Batch OnError="Continue" RootFolder="http://moss/Lists/CustomersList/FirstFolder"> <Method ID="1" Cmd="New"> <Field Name="ID">New</Field> <Field Name="CustomerName">Robert Hay</Field> <Field Name="CustomerAddress">Redmond</Field> <Field Name="Title">customer2</Field> </Method> </Batch>
The important attribute here is the RootFolder. You need to provide the URL of the folder where you wish to create the item. So right now the RootFolder value is http://moss/Lists/CustomersList/FirstFolder which means thus batch element will create an item inside a prexisting folder FirstFolder inside a list CustomerList.
Further if there is another subfolder say SecondFolder inside the FirstFolder folder where you wish to create the item, then the RootFolder should have this value http://moss/Lists/CustomersList/FirstFolder/SecondFolder
For how to proceed using this batch element this MSDN article proves to be the good source http://msdn.microsoft.com/en-us/library/lists.lists.updatelistitems(office.12).aspx
A great walk-thru on using the Lists.asmx web service is available here: http://www.codeproject.com/KB/sharepoint/SharePointListWebService.aspx
The MSDN library has some info on how to work with lists with folders: http://msdn.microsoft.com/en-us/library/lists.lists.updatelistitems(office.12).aspx