使用NTLM和自定义凭据调用SharePoint Web服务

时间:2014-07-16 12:39:03

标签: c# web-services sharepoint sharepoint-2010

我正在使用名为:copy.asmx

的SharePoint网络服务

这是我用来调用此服务的web.config

<binding name="CopySoap" closeTimeout="00:01:00" openTimeout="00:01:00"
          receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false"
          bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
          maxBufferPoolSize="524288" maxBufferSize="655360" maxReceivedMessageSize="655360"
          textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true"
          messageEncoding="Text">
          <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
            maxBytesPerRead="4096" maxNameTableCharCount="16384" />
          <security mode="TransportCredentialOnly">
            <transport clientCredentialType="Ntlm" proxyCredentialType="None"
                realm="" />
            <message clientCredentialType="UserName" algorithmSuite="Default" />
          </security>
        </binding>

我需要使用以下内容向此服务发送自定义凭据:

CopySoapClient client = new CopySoapClient();
client.ClientCredentials.Windows.ClientCredential = new NetworkCredential() { UserName = "foooooooo", Password = "foofoo", Domain = "domain" };

    FieldInformation myFieldInfo = new FieldInformation();
    FieldInformation[] myFieldInfoArray = { myFieldInfo };
    byte[] myByteArray;
    client.GetItem(XmlParser.GetUriFromConfiguration("LocalisationUri"), out myFieldInfoArray, out myByteArray);

是否可以使用自定义凭据调用NTLM sharepoint webservice的示例?

0 个答案:

没有答案