2012-06-19 48 views
2

這是參考我發佈的另外兩個SO問題:adding items to a Sharepoint list with VBAcalling 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,是否也需要包含對所有這些文件的引用?

回答

0

我解決了這個問題,而不使用另一個DLL,只是使用XMLHTTP POST操作。解決方案張貼here

1

恐怕雖然它的技術上可行(與大量的Jiggery Pockery - 是一個官方技術術語),但它沒有真正可行的嘗試使用沒有註冊的COM DLL。

一個簡單的腳本下載到每個客戶端會很快註冊DLL。