Update a Sharepoint list using VBSCRIPT via Web Se

Anything VBScript-related, including Windows Script Host, WMI, ADSI, and more.
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
User avatar
ismailc
Posts: 37
Last visit: Tue Jun 09, 2015 12:16 am

Update a Sharepoint list using VBSCRIPT via Web Se

Post by ismailc »

Good day, I need help. I'm trying to Update a Sharepoint list using VBSCRIPT via Web Services. I got this example from the Net but errors: Class not defined 'sitesWebServiceLists.Lists()'

Code: Select all

Dim listService 
Set listService = New sitesWebServiceLists.Lists()    
listService.Credentials = System.Net.CredentialCache.DefaultCredentials     
listService.Url = "<a href="http://sql2005-oss2007/Lists/Change%20Control/_vti_bin/Lists.asmx" target="_blank">http://sql2005-oss2007/Lists/Change%20Control/_vti_bin/Lists.asmx</A>"     
Dim ndListView 
Set ndListView = System.Xml.XmlNode = listService.GetListAndView("MyList", "")   
Dim strListID 
Set strListID = ndListView.ChildNodes(0).Attributes("Name").Value   
Dim strViewID 
Set strViewID = ndListView.ChildNodes(1).Attributes("Name").Value    
Dim doc 
Set doc = New System.Xml.XmlDocument() 
Dim batchElement 
Set batchElement = System.Xml.XmlElement = doc.CreateElement("Batch") 
batchElement.SetAttribute "OnError", "Continue" 
batchElement.SetAttribute "ListVersion", "1" 
batchElement.SetAttribute "ViewName", strViewID    
batchElement.InnerXml = "<Method ID='1' Cmd='Update'><Field Name='Status'>6</Field></Method>"   
listService.UpdateListItems strListID, batchElement


Please help getting this code working. Regards

User avatar
ismailc
Posts: 37
Last visit: Tue Jun 09, 2015 12:16 am

Update a Sharepoint list using VBSCRIPT via Web Se

Post by ismailc »

...ooh :(
Thanks for replying...

do you have any code for me please?

Regards

jvierra
Posts: 14890
Last visit: Mon Aug 02, 2021 5:28 am
Answers: 12
Has voted: 3 times
Been upvoted: 10 times

Update a Sharepoint list using VBSCRIPT via Web Se

Post by jvierra »

I have no idea of what you are trying to do. YOu need to write some script and someone here can help you fix errors or find out what is needed.

From your post there is no way to know what you want to do.

User avatar
ismailc
Posts: 37
Last visit: Tue Jun 09, 2015 12:16 am

Update a Sharepoint list using VBSCRIPT via Web Se

Post by ismailc »

I found this code but get error: Access denied at xmlHTTP.send(senddata)

Please help

Code: Select all

set xmlHTTP = CreateObject("Msxml2.XMLHTTP")
set xmlDoc = CreateObject("Msxml2.DOMDocument")
sQuery = "http://sql2005-0ss2007/Lists/Change%20Control/AllItems.aspx"
senddata="<Myapp_service_request><action step='1'><arg name='Vendor' value='xxxxx'/></action></Myapp_service_request>"

xmlHTTP.open "POST", sQuery, false
' on error resume next
xmlHTTP.send(senddata)
' on error goto 0

xmlDoc.async = false
xmlDoc.loadXML(xmlHTTP.responseText)

' Error Handling
if xmlDoc.parseError.errorCode <> 0 Then
'Error handling invalid response or XML not valid
'Wscript.echo "oops" & xmlDoc.parseError.errorCode & vbCrLf & xmlHTTP.responseText
else

'Treat Response
strXMLOUT = xmlDOC.XML
Wscript.echo strXMLOUT
Set xmlDoc = Nothing
Set xmlHTTP = Nothing
end if

User avatar
ismailc
Posts: 37
Last visit: Tue Jun 09, 2015 12:16 am

Update a Sharepoint list using VBSCRIPT via Web Se

Post by ismailc »

I would like to update a Sharepoint List with VBScript using Web Service

A specific column & record within the List i would like to update

The List/Document Library is located: http://sql2005-0ss2007/Lists/Change%20C ... Items.aspx

Please Help

jvierra
Posts: 14890
Last visit: Mon Aug 02, 2021 5:28 am
Answers: 12
Has voted: 3 times
Been upvoted: 10 times

Update a Sharepoint list using VBSCRIPT via Web Se

Post by jvierra »

YOu need the address of teh web service and the WSDl for teh web service.

YOu will not be able to do this with VBScript but it might be posible with PowerShell.


jvierra
Posts: 14890
Last visit: Mon Aug 02, 2021 5:28 am
Answers: 12
Has voted: 3 times
Been upvoted: 10 times

Update a Sharepoint list using VBSCRIPT via Web Se

Post by jvierra »

I see you have posted your request all over the web. If you had goiogles your request you would have immediately found that it cannot readily be done inscript.

This is one solution:
http://www.codeproject.com/KB/vbscript/ ... rator.aspx

It provide the required library code tobuild a proxy for VBScript.

Here is trhe easier way in PowerShell. PowerShell has access to teh NET web service proxy classes:

http://thepowershellguy.com/blogs/posh/ ... rvice.aspx


User avatar
ismailc
Posts: 37
Last visit: Tue Jun 09, 2015 12:16 am

Update a Sharepoint list using VBSCRIPT via Web Se

Post by ismailc »

I'm sorry my friend I'm becoming frustrated & negative.

I tried to execute the copy code in vbscript - no luck


$weather = New-WebServiceProxy -uri http://www.webservicex.com/globalweather.asmx?WSDL

PS H:> ([xml]$weather.GetWeather('Zurich-Kloten','Switzerland')).CurrentWeather
is there perhaps amother way as i have no clue what to do

User avatar
ismailc
Posts: 37
Last visit: Tue Jun 09, 2015 12:16 am

Update a Sharepoint list using VBSCRIPT via Web Se

Post by ismailc »

Please, please do

the code i posted previously gave Access Denied error

jvierra
Posts: 14890
Last visit: Mon Aug 02, 2021 5:28 am
Answers: 12
Has voted: 3 times
Been upvoted: 10 times

Update a Sharepoint list using VBSCRIPT via Web Se

Post by jvierra »

I di d some testing. The methods - any - will not work on SPS on SBS 2003 or later due to redirects. You will need to alter web.config to make this work and I don't recommend it if you are not well versed in manageing SPS.

Locked