我如何使用python的sharepoint(通过soap?)?

时间:2008-10-20 16:09:37

标签: python sharepoint soap ntlm suds

我想将Sharepoint与python(C-Python)一起使用

以前有人试过吗?

4 个答案:

答案 0 :(得分:10)

我怀疑自从这个问题得到解答后,SUDS库已经更新,以便自行处理所需的身份验证。在经历了各种各样的箍之后,我发现了这个诀窍:


from suds import WebFault
from suds.client import *
from suds.transport.https import WindowsHttpAuthenticated


user = r'SERVER\user'
password = "yourpassword"
url = "http://sharepointserver/_vti_bin/SiteData.asmx?WSDL"


ntlm = WindowsHttpAuthenticated(username = user, password = password)
client = Client(url, transport=ntlm)

答案 1 :(得分:9)

获取wsdl:

import sys

# we use suds -> https://fedorahosted.org/suds
from suds import WebFault
from suds.client import *
import urllib2

# my 2 url conf
# url_sharepoint,url_NTLM_authproxy 
import myconfig as my 

# build url
wsdl = '_vti_bin/SiteData.asmx?WSDL'
url = '/'.join([my.url_sharepoint,wsdl])


# we need a NTLM_auth_Proxy -> http://ntlmaps.sourceforge.net/
# follow instruction and get proxy running
proxy_handler = urllib2.ProxyHandler({'http': my.url_NTLM_authproxy })
opener = urllib2.build_opener(proxy_handler)

client = SoapClient(url, {'opener' : opener})

print client.wsdl

主要(平均)问题: sharepoint-server使用NTLM-Auth [:-(] 所以我不得不使用NTLM-Auth-Proxy

Rob和Enzondio:感谢您的提示!

答案 2 :(得分:4)

使用Python的SOAP非常简单。来自Dive Into Python的Here's a tutorial

答案 3 :(得分:3)

SharePoint公开了几种可用于查询和更新数据的Web服务。

我不确定Python的Web服务工具包是什么,但他们应该能够为这些服务构建代理而没有任何问题。

本文应该为您提供足够的信息以便开始使用。

http://www.developer.com/tech/article.php/3104621