Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Other Programming > VBScript
VBScript For questions and discussions related to VBScript.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VBScript section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old January 13th, 2010, 04:50 AM
Friend of Wrox
Join Date: Jan 2007
Posts: 115
Thanks: 2
Thanked 0 Times in 0 Posts
Question VBScript Web Service GetListItem - store returning value

Hi, the code works on my side
I need to get the retunring filed "ows_ID" value
in my vbscript wscript.echo .responseText then i see all the values but no clue on getting the "ows_ID" value

I done the GetListItem method working - but i don't know how to return a value & store in variable
I want to return the value of <FieldRef Name='ows_ID'/> & store in variable

url = "http://.../_vti_bin/Lists.asmx"
list = "Vendor Request"
batch = "<Query><Where><Eq><FieldRef Name='FileLeafRef'/><Value Type='Folder'>AB Test</Value></Eq></Where></Query>"
strviewfields = "<viewFields><FieldRef Name='ows_ID'/></viewFields>"
''soap wrapper plus some info in body
request = "<?xml version='1.0' encoding='utf-8'?>"
request = request + "<soap:Envelope xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'"
request = request + " xmlns:xsd='http://www.w3.org/2001/XMLSchema'"
request = request + " xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'>"
request = request + " <soap:Body>"
request = request + " <GetListItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'>"
request = request + " <listName>" & list & "</listName>"
request = request + " <query>" & batch & "</query>"
request = request + " <ViewFields>" & strviewfields & "</ViewFields>"
request = request + " </GetListItems>"
request = request + " </soap:Body>"
request = request + "</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","http://schemas.microsoft.com/sharepoint/soap/GetListItems"
.send request
' wscript.echo .responseText
end with

Please Help
Reply With Quote
  #2 (permalink)  
Old January 13th, 2010, 08:19 PM
Friend of Wrox
Join Date: Jun 2008
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts

You have to load the response into an XML DOM object and then use DOM methods to extract the information.

This is pretty old and uses a prior version of the DOM, but it should get you started:
Reply With Quote

Similar Threads
Thread Thread Starter Forum Replies Last Post
Web Service Get List ID with VBSCRIPT to filter on for UpdateListItems ismailc SharePoint Development 2 January 27th, 2010 08:32 AM
Web Service Consuming another web service CraigWhitfield EJB 0 January 10th, 2008 08:38 AM
Returning dataset to web application niravpatel .NET Web Services 4 March 13th, 2006 05:43 PM
Service Oriented Web Service aldwinenriquez .NET Web Services 2 September 15th, 2005 03:25 AM
VBScript to verify if service running in IIS savoym VBScript 0 July 30th, 2003 12:53 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.