To Store values to User Field and URL Field, we have to store in different format.
Because the The User Field is a Lookup Field, getting value from User Information List. The URL Field contains two values, one for URL and another one for URL Description.
User Field Format: [ID];#[User Login Name]
URL Field Format : [URL], [URL Description] // 逗号后有一空格,给其赋值时需小心
Below i give the sample code for addng new list item with URL and User Fields,
UserGroupWebService.UserGroup ugService=new UserGroupWebService.UserGroup();
ListsWebService.Lists lService=new ListsWebService.Lists();
//Get User ID from User Login Name
XmlNode ugNode=ugService.GetUserInfo("Server\\LoginName");
XmlDocument ugdoc = new XmlDocument();
ugdoc.LoadXml(ugNode.OuterXml);
XmlNodeList ugList = ugdoc.GetElementsByTagName("User");
string id = ugList[0].Attributes["ID"].Value;
//Build the xml for adding new list item
string strBatch = @"<Method ID='1' Cmd='New'>
<Field Name='Title'>Sample Title</Field>
<Field Name='UserName'>" + id + @";#SERVER\\LoginName</Field>
<Field Name='SampleUrl'>http://www.microsoft.com, Microsoft Site</Field>
</Method>";
XmlDocument xmlDoc = new System.Xml.XmlDocument();
System.Xml.XmlElement elBatch = xmlDoc.CreateElement("Batch");
elBatch.InnerXml = strBatch;
//Addding item to the List
XmlNode ndReturn = lService.UpdateListItems("<List Name>", elBatch);
Before coding add the (~site/_vti_bin/Lists.asmx and ~site/_vti_bin/UserGroup.asmx) webservices as references.
<Field ID="{c29e077d-f466-4d8e-8bbe-72b66c5f205c}"Name="URL"
SourceID="http://schemas.microsoft.com/sharepoint/v3"StaticName="URL"
Group="Base Columns"Type="URL"DisplayName="URL"ColName="nvarchar3"
RowOrdinal="0"ColName2="nvarchar4"RowOrdinal2="0"Format="Image"Version="1"/>