将Python连接到SharePoint
希望通过python与代码下方的简单脚本连接到SharePoint
from office365.runtime.auth.user_credential import UserCredential
def get_sharepoint_context_using_user():
# Get sharepoint credentials
sharepoint_url = 'https://abc.sharepoint.com'
# Initialize the client credentials
user_credentials = UserCredential("[email protected]", "fakePass123")
# create client context object
ctx = ClientContext(sharepoint_url).with_credentials(user_credentials)
return ctx
没有任何错误,但是当我调用 get_sharepoint_context_context_user_user()时,在我的脚本的另一部分中,我会收到以下错误,
NameError: name 'get_sharepoint_context_using_app' is not defined
我也有一个红色“ x”在线上 ctx = clientContext(sharepoint_url).with_credentials(user_credentials)
说 client client上下文不确定。
有什么想法吗?
Looking to connect to SharePoint via python with the simple script below
from office365.runtime.auth.user_credential import UserCredential
def get_sharepoint_context_using_user():
# Get sharepoint credentials
sharepoint_url = 'https://abc.sharepoint.com'
# Initialize the client credentials
user_credentials = UserCredential("[email protected]", "fakePass123")
# create client context object
ctx = ClientContext(sharepoint_url).with_credentials(user_credentials)
return ctx
The code runs without any errors but when I call the get_sharepoint_context_using_user() later on in another section of my script I receive the following error
NameError: name 'get_sharepoint_context_using_app' is not defined
There is also a red "x" on the line withctx = ClientContext(sharepoint_url).with_credentials(user_credentials)
saying client context is undefined.
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论