Hi,
I have this script that writes the number of records of list collection to a text file but I'm not sure how I can write the values to the file. can you help?
thank you.
--------------------------
Option Explicit
Dim url
Dim list
Dim viewFields
Dim request
Dim xmlDoc
Dim elements
dim myFSO
dim writestuff
Set xmlDoc = CreateObject("MSXML2.DOMDocument.6.0")
xmlDoc.async = False
url = "list = "Action"
viewFields = "<viewFields><FieldRef Name='ows_ID'/></viewFields>"
request = "<?xml version='1.0' encoding='utf-8'?>" + _
"<soap:Envelope xmlns:xsi=' + _
" xmlns:xsd=' + _
" xmlns:soap=' + _
" <soap:Body>" + _
" <GetListItems xmlns=' + _
" <listName>" & list & "</listName>" + _
" <ViewFields>" & viewFields & "</ViewFields>" + _
" </GetListItems>" + _
" </soap:Body>" + _
"</soap:Envelope>"
'post it up and look at the response
with CreateObject("Microsoft.XMLHTTP")
.open "Get", url, False, null, null
.setRequestHeader "Content-Type", "text/xml; charset=utf-8"
.setRequestHeader "SOAPAction"," .send request
xmlDoc.loadXML(.responseText)
Set elements = xmlDoc.getElementsByTagName("rs:data")
'wscript.echo "Number of items in list: " + elements(0).getAttribute("ItemCount")
Set myFSO = CreateObject("Scripting.FileSystemObject")
Set WriteStuff = myFSO.OpenTextFile("correct.txt", 8, True)
'WriteStuff.WriteLine(elements(0).getAttribute("ItemCount"))
WriteStuff.WriteLine(elements(0).getAttribute("value"))
WriteStuff.Close
SET WriteStuff = NOTHING
SET myFSO = NOTHING
end with
-------------------------------------------------
I have this script that writes the number of records of list collection to a text file but I'm not sure how I can write the values to the file. can you help?
thank you.
--------------------------
Option Explicit
Dim url
Dim list
Dim viewFields
Dim request
Dim xmlDoc
Dim elements
dim myFSO
dim writestuff
Set xmlDoc = CreateObject("MSXML2.DOMDocument.6.0")
xmlDoc.async = False
url = "list = "Action"
viewFields = "<viewFields><FieldRef Name='ows_ID'/></viewFields>"
request = "<?xml version='1.0' encoding='utf-8'?>" + _
"<soap:Envelope xmlns:xsi=' + _
" xmlns:xsd=' + _
" xmlns:soap=' + _
" <soap:Body>" + _
" <GetListItems xmlns=' + _
" <listName>" & list & "</listName>" + _
" <ViewFields>" & viewFields & "</ViewFields>" + _
" </GetListItems>" + _
" </soap:Body>" + _
"</soap:Envelope>"
'post it up and look at the response
with CreateObject("Microsoft.XMLHTTP")
.open "Get", url, False, null, null
.setRequestHeader "Content-Type", "text/xml; charset=utf-8"
.setRequestHeader "SOAPAction"," .send request
xmlDoc.loadXML(.responseText)
Set elements = xmlDoc.getElementsByTagName("rs:data")
'wscript.echo "Number of items in list: " + elements(0).getAttribute("ItemCount")
Set myFSO = CreateObject("Scripting.FileSystemObject")
Set WriteStuff = myFSO.OpenTextFile("correct.txt", 8, True)
'WriteStuff.WriteLine(elements(0).getAttribute("ItemCount"))
WriteStuff.WriteLine(elements(0).getAttribute("value"))
WriteStuff.Close
SET WriteStuff = NOTHING
SET myFSO = NOTHING
end with
-------------------------------------------------