我有一个 Excel 工作簿,我需要使用 Excel VBA 在 SharePoint 网站中发布它。所以我使用以下代码在模块中创建了一个方法:
Private sc_Lists As SoapClient30
Public c_WSDL_URL As String
Private Const c_SERVICE As String = "Lists"
Private Const c_PORT As String = "ListsSoap"
Private Const c_SERVICE_NAMESPACE As String = "http://schemas.microsoft.com/sharepoint/soap/"
Private Sub Class_Initialize()
Dim str_WSML As String
str_WSML = ""
Set sc_Lists = New SoapClient30
c_WSDL_URL = glb_URL
sc_Lists.MSSoapInit2 c_WSDL_URL, str_WSML, c_SERVICE, c_PORT, c_SERVICE_NAMESPACE
sc_Lists.ConnectorProperty("WinHTTPAuthScheme") = &H1
sc_Lists.ConnectorProperty("UseSSL") = True
sc_Lists.ConnectorProperty("AuthUser") = "username"
sc_Lists.ConnectorProperty("AuthPassword") = "pass"
End Sub
问题是当我打开 excel 文档并尝试发布它时,它会询问我的 SharePoint 网站的凭据,即使我已经在代码中提供了它们,如上所示。我需要的是防止在发布时询问凭据。