Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3979950
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T05:13:58+00:00 2026-05-20T05:13:58+00:00

I have a program as such // establish proxy obj SPLists.Lists listservice = new

  • 0

I have a program as such

    // establish proxy obj
    SPLists.Lists listservice = new SPLists.Lists();

    // credentials
    listservice.PreAuthenticate = true;


    // user name
    Console.Write("Username (e.g. bobdole@xyz.com): ");
    string usrname = Console.ReadLine().Trim();
    Console.Write("\n");

    // pw
    Console.Write("Password: ");
    string password = MaskedConsoleReader.ReadLine();

    // auth
    listservice.Credentials = new NetworkCredential(usrname, password);

    // List Service URL
    listservice.Url =
      "https://wss.xyz.com/_vti_bin/Lists.asmx";

    // Instantiate an XmlDocument object 
    System.Xml.XmlDocument xmlDoc = new System.Xml.XmlDocument();


    /* Assign values to the string parameters of the GetListItems method, 
    using GUIDs for the listName and viewName variables. For listName, 
    using the list display name will also work, but using the list GUID 
    is recommended. For viewName, only the view GUID can be used. 
    Using an empty string for viewName causes the default view to be used.*/
    // Work ticket list
    // {5B79ED7D-ECB7-447A-9331-22984E52EB7D}
    // All tickets view
    // {00F95DDD-C383-4E4A-94F2-977FDA7A7F74}

    string listName = "{5B79ED7D-ECB7-447A-9331-22984E52EB7D}";
    string viewName = "{00F95DDD-C383-4E4A-94F2-977FDA7A7F74}";
    string rowLimit = "4000";

    /*Use the CreateElement method of the document object to create 
    elements for the parameters that use XML.*/
    System.Xml.XmlElement query = xmlDoc.CreateElement("Query");
    System.Xml.XmlElement viewFields =
        xmlDoc.CreateElement("ViewFields");
    System.Xml.XmlElement queryOptions =
        xmlDoc.CreateElement("QueryOptions");

    /*To specify values for the parameter elements (optional), assign 
    CAML fragments to the InnerXml property of each element.*/
    query.InnerXml = "<Where><Gt><FieldRef Name=\"ID\" />" +
        "<Value Type=\"Counter\">3</Value></Gt></Where>";
    viewFields.InnerXml = "<FieldRef Name=\"Title\" />";
    queryOptions.InnerXml = "";

    /* Declare an XmlNode object and initialize it with the XML response 
    from the GetListItems method. The last parameter specifies the GUID 
    of the Web site containing the list. Setting it to null causes the 
    Web site specified by the Url property to be used.*/

    DateTime abc = DateTime.Now;
    string format = "yyyy-M-dd_HH-MM-ss";
    string xyz = abc.ToString(format);
    string fName = "dump-" + xyz + ".txt";

    try
    {

        System.Xml.XmlNode nodeListItems =
            listservice.GetListItems
            (listName, viewName, query, viewFields, rowLimit, queryOptions, null);

        StreamWriter outfile = new StreamWriter(fName);


        /*Loop through each node in the XML response and display each item.*/
        foreach (System.Xml.XmlNode listItem in nodeListItems)
        {
            Console.WriteLine(listItem.OuterXml + "\n");
            outfile.WriteLine(listItem.OuterXml);

        }
        outfile.Close();


    }
    catch (Exception ex)
    {
        Console.WriteLine("ERROR!: " + ex.ToString());
    }

    Console.WriteLine("\n");
    Console.WriteLine("Contents dumped to: " + fName);

    // hold program
    Console.ReadLine();

}

Which yields a string (from listItem.OuterXML):

<rs:data ItemCount="896" xmlns:rs="urn:schemas-microsoft-com:rowset">
[...]
<z:row ows_Title="Do A B AND C" ows_ProjectID="1165;#_INTERNAL" ows__ModerationStatus="0" ows__Level="1" ows_Deliverables="&lt;div&gt;Implementation of blah blah blah" ows_AssignedTo="7;#blah@xyz.com" ows_ID="5" ows_owshiddenversion="29" ows_UniqueId="5;#{DD129C47-C9E0-4962-A516-B8280EB77800}" ows_FSObjType="5;#0" ows_Created="2009-02-27 08:25:28" ows_Category="7 Internal Project" ows_Comment="&lt;div&gt;Changing to Queue of 22 blah can do blah" ows_Priority="4 Low" ows_Status="1 In Queue" ows_Description_x0020_of_x0020_Work="do blah and blah" ows_FileRef="5;#Lists/Work Tick/5_.000" ows_ProjectOwner="7;#blah@xyz.com" ows_MetaInfo="5;#" xmlns:z="#RowsetSchema" />
[...]
</rs:data>

There are roughly 800 lines like this in the returned string. What’s the easiest way to parse the data from each line? I’d also like to strip out the HTML if possible since I want to eventually dump this into SQL server using the SQLClient namespace.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T05:13:59+00:00Added an answer on May 20, 2026 at 5:13 am

    It would not have been necessary to parse the data if you had not converted it into strings by using OuterXml. The parsed data are already present as XmlNode objects.

    1. Exactly what sort of “parsing” do you then require?
    2. Where do you see any HTML? All I see here is XML.
    3. If you are using SQL Server 2005 or later, then you can store the data in columns of type “XML”.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to multithread something and i have my program set up such that
I am wondering if such thing is possible: I have a java program that
I have a such syntax in program /* The Object1 is allowed to be
I have a program that creates a Windows user account using the NetUserAdd() API
I have a program for some scientific simulation stuff, and as such needs to
I have 2 threads running a chat program such that one is a server
Lets say we have a program which contains such classes: public interface AbstractItem {
I have a program in C++ that stores certain files such as movies, mp3
I have a program in which the user adds multiple objects to a scene.
Say I have a Java program such: //case1 Long first = 1; Long second

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.