這是參考我發佈的另外兩個SO問題:adding items to a Sharepoint list with VBA和calling UpdateListItems from VBA。如何在VBA中使用DLL而無需註冊它?
我想基於某些Excel計算結果更新一個新數據行的Sharepoint列表。我目前的方法是對Sharepoint網站的Web服務的SOAP調用。我已經使用SOAP 3.0庫在本地機器上成功完成了這項工作。問題是這是20-30個用戶共享的電子表格,所以我不想要一個需要每個用戶註冊一個DLL的解決方案。
我嘗試將MSSOAP30.DLL放置在與共享電子表格相同的文件夾中,然後通過瀏覽將其添加爲參考。冉下面的代碼:
Sub test()
Dim soap As MSSOAPLib30.SoapClient30
Dim XMLstr As String
Dim listid As String
Dim listname As String
Set soap = New SoapClient30
Call soap.mssoapinit(par_wsdlfile:="http://wss/mySharepointSite/_vti_bin/lists.asmx?wsdl")
listid = "{e285aa1a-my-list-ID-d446cdbf091e}"
listname = "thisList"
XMLstr ="<Batch OnError='continue' ListVersion='1' ViewName='" & ListView & "'>" & _
"<Method ID='1' Cmd='New'>" & _
"<Field Name='ID'>New</Field>" & _
"<Field Name='personID'>1337</Field>" & _
"</Method>"
"</Batch>"
soap.UpdateListItems listid, XMLstr
End Sub
但是,當我跑的代碼,soap.UpdateListItems
提供了以下錯誤:
Run-time error '-2147221164 (80040154)':
Client:The connector could not be created. There might be an invalid endPoint specified in the WSDL file HRESULT=0x80040154: Class not registered
-Client:Unspecified client error. HRESULT=0x80040154: Class not registered
再次,此代碼的工作,我已經註冊MSSOAP 3.0我的本地機器的罰款。也許瀏覽到MSSOAP30.DLL引用不足以正確定義SoapClient30
對象?我看到\ MSSoap \ Binaries文件夾中有很多其他DLL,是否也需要包含對所有這些文件的引用?