hello guys! i have a code snippet below that basically retrieve some information from sharepoint portal list service which returns something in XML fragment in the following form that contains information about the list items and that can be assigned to a System.Xml.XmlNode object. But im having hard time in extracting the item one-by-one in each row like the LinkTitle, EventDate, etc. can anybody please help on this..Thanks in advance!!
Code;
Return Value:Code:List_Service.Lists listService = new List_Service.Lists(); //listService.Credentials= System.Net.CredentialCache.DefaultCredentials; listService.Credentials = new NetworkCredential("absalvamante", "lovekoh++", "transco"); listService.PreAuthenticate = true; 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='Title' /><FieldRef Name='EventDate'/>"; try { XmlNode ndListItems = listService.GetListItems("Events", null, ndQuery, null, null, ndQueryOptions); 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); }
Code:<listitems xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:z="#RowsetSchema" xmlns="http://schemas.microsoft.com/sharepoint/soap/"> <rs:data ItemCount="7"> <z:row ows_fRecurrence="0" ows_LinkTitle="(SP066) Negros - Panay Stage 2 - Opening of Bids" ows_EventDate="2006-10-20T05:30:00Z" ows_EndDate="2006-10-20T09:00:00Z" ows_Location="Dela Paz" ows_ID="8" ows_owshiddenversion="3" /> <z:row ows_fRecurrence="0" ows_LinkTitle="(SP073) Northern Panay - Opening of Bids" ows_EventDate="2006-10-20T05:30:00Z" ows_EndDate="2006-10-20T09:00:00Z" ows_Location="Dela Paz" ows_ID="19" ows_owshiddenversion="2" /> <z:row ows_fRecurrence="0" ows_LinkTitle="(SP072) Steel Pole-Sucat Araneta - Opening of Bids" ows_EventDate="2006-10-16T05:30:00Z" ows_EndDate="2006-10-16T09:00:00Z" ows_Location="Rodriguez" ows_ID="23" ows_owshiddenversion="3" /> <z:row ows_fRecurrence="0" ows_LinkTitle="(B06-08) Microwave SDH - Opening of Bids" ows_EventDate="2006-10-18T05:30:00Z" ows_EndDate="2006-10-18T09:00:00Z" ows_Location="Rodriguez" ows_ID="25" ows_owshiddenversion="3" /> <z:row ows_fRecurrence="0" ows_LinkTitle="(B06-07) Microwave Luzon-Visayas - Opening of Bids" ows_EventDate="2006-10-18T05:30:00Z" ows_EndDate="2006-10-18T09:00:00Z" ows_Location="Dela Paz" ows_ID="26" ows_owshiddenversion="1" /> <z:row ows_fRecurrence="0" ows_LinkTitle="(SP082) Makban Remaining Works - Bid Opening" ows_EventDate="2006-10-20T05:30:00Z" ows_Location="Rodriguez" ows_ID="32" ows_owshiddenversion="2" /> <z:row ows_fRecurrence="0" ows_LinkTitle="(B06-019) Steel Poles CY 2007 - Bid Opening" ows_EventDate="2006-10-25T02:00:00Z" ows_ID="34" ows_owshiddenversion="1" /> </rs:data> </listitems>




Reply With Quote