【发布时间】:2013-08-18 00:52:44
【问题描述】:
我正在尝试使用自定义 C# 代码从 CRM 工作流调用 SharePoint Web 服务。但是,当我运行代码时,出现以下错误:
The provided URI scheme 'https' is invalid; expected 'http'.
Parameter name: via
这是有问题的代码:
#region Set up security binding and service endpoint
BasicHttpBinding binding = new BasicHttpBinding(BasicHttpSecurityMode.TransportCredentialOnly);
binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Ntlm;
binding.Security.Transport.ProxyCredentialType = HttpProxyCredentialType.Ntlm;
EndpointAddress endpoint = new EndpointAddress(endpointAddress);
#endregion
#region Create the client and supply appropriate credentials
CopySPContents.CopyService.SharepointFileServiceClient client = new CopySPContents.CopyService.SharepointFileServiceClient(binding, endpoint);
client.ClientCredentials.Windows.ClientCredential = System.Net.CredentialCache.DefaultNetworkCredentials;
client.ClientCredentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Impersonation;
#endregion
#region Call the web service and trace its response
String response = client.CopyFolderContentsAcrossSites(sourceSiteURL, sourceFolderURL, destinationSiteURL, destinationFolderURL);
#endregion
在调用客户端方法的行String response = client.CopyFolderContentsAcrossSites(sourceSiteURL, sourceFolderURL, destinationSiteURL, destinationFolderURL); 上抛出错误。
感谢您的帮助,
斯科特
【问题讨论】:
-
TransportCredentialOnly 不适用于“https”。对于“https”,您需要使用 Transport 或 TransportWithMessageCredential。
-
谢谢,我会试试这个并回复你
-
成功了!我将它切换到运输,它完美地工作。谢谢!
-
@JimRhodes 您可以将您的评论写为答案,这样其他用户会找到答案作为答案
标签: c# wcf sharepoint dynamics-crm-2011