Open SharePoint list xml data in recordset

somnath_it2006

Well-known Member
Joined
Apr 11, 2009
Messages
574
Hi All,

I am trying to extract data from SharePoint list to excel using ado recordset.

Below steps I have taken in this procedure:

1. Load xml data of SharePoint list in DOMDocument object
2. Write that xml data in ADODB.Stream object
3. Open recordset on that ADODB.Stream object

And then I use that recordset data to generate some reports.

Now my problem is I am not able to excecute the SQL query on that recordset or xml data.
That recordset contains 20000 rows of data so it's taking too much of time to go through each record.
I want to run the SQL query on that recordset.

If you know something please help me on this...

Below is the code I am using:



Code:
Sub test()
    
    
    Dim xmlDoc As DOMDocument
    Set xmlDoc = New DOMDocument
    
    xmlDoc.async = False
    
    
    '============= Step 1 =============
    ' Load xml into DOMDocument object
    '==================================
    xmlDoc.Load ("http://SharepointSite/_vti_bin/owssvr.dll?Cmd=Display&List={f0fd1ddb%2Dc9a4%2D44ac%2Daaec%2D5b9fe952acdf}&XMLDATA=TRUE&RowLimit=0")
    
    
    
    '==================== Step 2 =================
    '  Write that xml data in ADODB.Stream object
    '=============================================
    
    Dim oStream As ADODB.Stream
    
    Set oStream = New ADODB.Stream
    
    oStream.Open
    oStream.WriteText xmlDoc.XML
    oStream.Position = 0

    
    
    '==================== Step 3 =================
    ' Open recordset on that ADODB.Stream object
    '=============================================
    
    Dim rs As ADODB.Recordset
    
    Set rs = New ADODB.Recordset
    
    [COLOR="Red"]' I want to run SQl statement here
    rs.Open oStream[/COLOR]
    
    
End Sub

Please tell me if you require more specifications...
 
Last edited:

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"

Forum statistics

Threads
1,214,922
Messages
6,122,281
Members
449,075
Latest member
staticfluids

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top