我正在尝试使用此代码从服务器获取组织列表:
var clientCredentials = new ClientCredentials();
clientCredentials.Windows.ClientCredential.Domain = "domain";
clientCredentials.Windows.ClientCredential.UserName = "user";
clientCredentials.Windows.ClientCredential.Password = "password";
var discoveryUri = new Uri(String.Format("http://{0}/XRMServices/2011/Discovery.svc", "10.20.30.40"));
var discoveryServiceProxy = new DiscoveryServiceProxy(discoveryUri, null, clientCredentials, null);
discoveryServiceProxy.Authenticate();
var retrieveOrganizationResponse = (RetrieveOrganizationsResponse)discoveryServiceProxy.Execute(new RetrieveOrganizationRequest());
但在最后一行抛出此错误:
机构名称
异常类型是这样的:
请帮忙解决这个问题 .
1 回答
我认为这可能与你如何形成
new RetrieveOrganizationRequest()
有关 - 具体而言,你不提供任何论据 .有一个示例here,它显示了如何从Discovery Service获取组织列表 .