6 Replies - 9102 Views - Last Post: 04 January 2010 - 06:16 AM Rate Topic: -----

#1 ismailc  Icon User is offline

  • D.I.C Head

Reputation: 3
  • View blog
  • Posts: 98
  • Joined: 14-September 07

Update a Sharepoint list using VBSCRIPT via Web Services

Posted 31 December 2009 - 12:50 AM

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()'


Dim listService 
Set listService = New sitesWebServiceLists.Lists()	

listService.Credentials = System.Net.CredentialCache.DefaultCredentials	 
listService.Url = "http://sql2005-oss2007/Lists/Change%20Control/_vti_bin/Lists.asmx"	 

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

Is This A Good Question/Topic? 0
  • +

Replies To: Update a Sharepoint list using VBSCRIPT via Web Services

#2 ismailc  Icon User is offline

  • D.I.C Head

Reputation: 3
  • View blog
  • Posts: 98
  • Joined: 14-September 07

Re: Update a Sharepoint list using VBSCRIPT via Web Services

Posted 31 December 2009 - 02:22 AM

The above is NOT vbscript code. It is VB.NET code. It is also code that updates an XML file and not a Sharepoint server.

Need to do the following:

I have an application that codes in VBScript. I then have a Sharepoint List that I would like to update. (http://sql2005-oss2007/Lists/Change%20Control/Allitems.aspx)

The list on the server has a column i would like to update using vbscript. I have been searching & have no code becuase i don't know how.All i know it uses Web Service to communicate with the Sharepoint List

Regards
Was This Post Helpful? 0
  • +
  • -

#3 ismailc  Icon User is offline

  • D.I.C Head

Reputation: 3
  • View blog
  • Posts: 98
  • Joined: 14-September 07

Re: Update a Sharepoint list using VBSCRIPT via Web Services

Posted 31 December 2009 - 03:16 AM

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

Please help

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



Was This Post Helpful? 0
  • +
  • -

#4 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6064
  • View blog
  • Posts: 23,520
  • Joined: 23-August 08

Re: Update a Sharepoint list using VBSCRIPT via Web Services

Posted 31 December 2009 - 06:34 AM

Sounds like cross-domain error maybe. This may be helpful.
Was This Post Helpful? 0
  • +
  • -

#5 ismailc  Icon User is offline

  • D.I.C Head

Reputation: 3
  • View blog
  • Posts: 98
  • Joined: 14-September 07

Re: Update a Sharepoint list using VBSCRIPT via Web Services

Posted 04 January 2010 - 12:48 AM

Thank You this helped getting pass the Access

But now I get another error line 8 sending the data.

"Resource not found"

I'm not sure if this is the correct method to use :(

I only have untill today unless i have to leave it.
Was This Post Helpful? 0
  • +
  • -

#6 ismailc  Icon User is offline

  • D.I.C Head

Reputation: 3
  • View blog
  • Posts: 98
  • Joined: 14-September 07

Re: Update a Sharepoint list using VBSCRIPT via Web Services

Posted 04 January 2010 - 01:23 AM

Good day, Thank You for helping.

I'm not sure if the above is the correct method to update a Sharepoint list.

How do I use built in web service method to update my list?
http://sql2005-oss20..._bin/Lists.asmx

I have a UpdateList & UpdateListItem.

How do call these methods for my list in VBscript passing the list record i want to update & new value to a column

Please help - i only have until today to get this going
Was This Post Helpful? 0
  • +
  • -

#7 ismailc  Icon User is offline

  • D.I.C Head

Reputation: 3
  • View blog
  • Posts: 98
  • Joined: 14-September 07

Re: Update a Sharepoint list using VBSCRIPT via Web Services

Posted 04 January 2010 - 06:16 AM

I found this code, but I have a document Library list.

I'm testing to create an item withinn the library.
The following code does not give any errors but does not create the item
Please help
'some vars
url = ".../Forms/_vti_bin/lists.asmx"
list = "{...}" 'can be GUID too
id = 678
title = "TESTING" 'wscript.arguments(0)
'the caml
'batch = "<Batch onerror='Continue' ListVersion='1'>"
batch = "<Batch onerror='Continue' PreCalc='TRUE' ListVersion='0'>"
batch = batch + " <Method ID='1' Cmd='New'>"
batch = batch + "  <Field Name='ID'>New</Field>"
batch = batch + "  <Field Name='FSObjType'>1</Field>"
batch = batch + "  <Field Name='BaseName'>Name</Field>"
batch = batch + "  <Field Name='ID'>678</Field>"
batch = batch + "  <Field Name='Title'>" & title & "</Field>"
'batch = batch + "  <Field Name='Name'>New</Field>"
'batch = batch + "  <Field Name='Title'>" & title & "</Field>"
'batch = batch + "  <Field Name='AssignedTo'>" & id & "</Field>"
batch = batch + " </Method>"
batch = batch + "</Batch>"
'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 + "  <UpdateListItems xmlns='http://schemas.microsoft.com/sharepoint/soap/'>"
request =  request + "			  <listName>" & list & "</listName>"
request =  request + "			  <updates>" & batch & "</updates>"
request =  request + "  </UpdateListItems>"
request =  request + "  </soap:Body>"
request =  request + "</soap:Envelope>"
'post it up and look at the response
with CreateObject("Microsoft.XMLHTTP")
 .open "POST", url, False , "..." , "..."
 .setRequestHeader "Content-Type", "text/xml; charset=utf-8" 
 .setRequestHeader "SOAPAction","http://schemas.microsoft.com/sharepoint/soap/UpdateListItems"
 .send request
 wscript.echo .responseText 
end with


Was This Post Helpful? 0
  • +
  • -

Page 1 of 1