如何通过Web服务获取SharePoint的认证提供者?

2 投票
1 回答
1052 浏览
提问于 2025-04-16 11:17

如何通过网络服务从SharePoint获取认证提供者?

我正在通过Python应用程序登录SharePoint。我需要找到SharePoint网站上选择的认证提供者。该怎么做呢?

1 个回答

2

你不能直接获取提供者实例,然后像这样使用 Membership.ValidateUser(username, password)

你需要先创建一个对 身份验证 Web 服务 的引用,然后执行登录操作(下面是 C# 的例子 - 你在 Python 中也需要做类似的事情):

string siteUrl = "http://example.com/sites/hr";
AuthenticationService.Authentication client = new AuthenticationService.Authentication();

client.AllowAutoRedirect = true;
client.CookieContainer = new CookieContainer();
client.Url = siteUrl + "_vti_bin/Authentication.asmx";

AuthenticationService.LoginResult loginResult = client.Login(username, password);
if (loginResult.ErrorCode == AuthenticationService.LoginErrorCode.NoError)
{
    string cookie = client.CookieContainer.GetCookieHeader(new Uri(siteUrl));
}

然后使用获得的 cookie。


可以看看这篇关于 用 PHP 读取 SharePoint 列表 的文章 - 这可能会给你一些关于如何在非微软环境中访问 SharePoint 的想法。

撰写回答