Publishing an Excel Workbook in Sharepoint Site

三世轮回 提交于 2019-12-10 16:17:05

问题


I have an excel workbook and I need to publish it in a SharePoint site using Excel VBA. So I created a method in a module using the below code:

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 

The problem is when I open the excel document and try to publish it then it asks for the credentials of my SharePoint site even though I have provided them in the code as can be seen above. What I need is to prevent asking credentials when publishing.


回答1:


I've had auth issues when attempting to push to SP using VBA; it is simply to fragile and finicky. One solution I've used at my work is instead to map the SP site as a network drive and simply save the file directly (like in this UC tutorial), thus avoiding this problem.



来源:https://stackoverflow.com/questions/12639071/publishing-an-excel-workbook-in-sharepoint-site

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!