SharePoint Developer Center >
SharePoint Products and Technologies Forums
>
SharePoint - Development and Programming
>
Web Service doesnt return the Added column
Web Service doesnt return the Added column
- After adding a text field to a my list, the "GetListItems" method of the Lists.asmx web service does not return the newly added column. Is this the standard behavior of the web service? Thanks.
Answers
- Hi JohnBGood, first pl make sure your column is added to your list. second, pl put your code snippet here that you are using to call GetListItems method to return list items.
listSvc.Lists list = new spConsole.listService.Lists();
list.Credentials = System.Net.CredentialCache.DefaultCredentials;
XmlDocument xmlDoc = new System.Xml.XmlDocument();
XmlNode ndQuery = xmlDoc.CreateNode(XmlNodeType.Element,"Query","");
XmlNode ndViewFields = xmlDoc.CreateNode(XmlNodeType.Element,"ViewFields","");
XmlNode ndQueryOptions = xmlDoc.CreateNode(XmlNodeType.Element,"QueryOptions","");
ndQueryOptions.InnerXml = "<IncludeMandatoryColumns>FALSE</IncludeMandatoryColumns>" +
"<DateInUtc>TRUE</DateInUtc>";
ndViewFields.InnerXml = "<FieldRef Name='Field1' /><FieldRef Name='Field2'/>";
ndQuery.InnerXml = "<Where><Eq><FieldRef Name='Status'/><Value Type='Text'>Completed</Value></Eq></Where>";
try
{
XmlNode ndListItems = list.GetListItems("List_Name", null, ndQuery, ndViewFields, null, ndQueryOptions, null);
MessageBox.Show(ndListItems.OuterXml);
}
catch (System.Web.Services.Protocols.SoapException ex)
{
MessageBox.Show("Message:\n" + ex.Message + "\nDetail:\n" + ex.Detail.InnerText + "\nStackTrace:\n" + ex.StackTrace);
}- Proposed As Answer byHereICome SharePoint Wednesday, November 11, 2009 12:44 AM
- Marked As Answer byAaron Han - MSFTModeratorWednesday, November 11, 2009 2:19 AM
All Replies
- Hi JohnBGood, first pl make sure your column is added to your list. second, pl put your code snippet here that you are using to call GetListItems method to return list items.
listSvc.Lists list = new spConsole.listService.Lists();
list.Credentials = System.Net.CredentialCache.DefaultCredentials;
XmlDocument xmlDoc = new System.Xml.XmlDocument();
XmlNode ndQuery = xmlDoc.CreateNode(XmlNodeType.Element,"Query","");
XmlNode ndViewFields = xmlDoc.CreateNode(XmlNodeType.Element,"ViewFields","");
XmlNode ndQueryOptions = xmlDoc.CreateNode(XmlNodeType.Element,"QueryOptions","");
ndQueryOptions.InnerXml = "<IncludeMandatoryColumns>FALSE</IncludeMandatoryColumns>" +
"<DateInUtc>TRUE</DateInUtc>";
ndViewFields.InnerXml = "<FieldRef Name='Field1' /><FieldRef Name='Field2'/>";
ndQuery.InnerXml = "<Where><Eq><FieldRef Name='Status'/><Value Type='Text'>Completed</Value></Eq></Where>";
try
{
XmlNode ndListItems = list.GetListItems("List_Name", null, ndQuery, ndViewFields, null, ndQueryOptions, null);
MessageBox.Show(ndListItems.OuterXml);
}
catch (System.Web.Services.Protocols.SoapException ex)
{
MessageBox.Show("Message:\n" + ex.Message + "\nDetail:\n" + ex.Detail.InnerText + "\nStackTrace:\n" + ex.StackTrace);
}- Proposed As Answer byHereICome SharePoint Wednesday, November 11, 2009 12:44 AM
- Marked As Answer byAaron Han - MSFTModeratorWednesday, November 11, 2009 2:19 AM


