crm ifd用户名和密码

时间:2010-08-31 11:15:22

标签: dynamics-crm dynamics-crm-4

我想知道如何获取用户名和密码,并在设置crmservice连接时使用它

CrmDiscoveryService disco = new CrmDiscoveryService();
disco.Url = "https://localhost/MSCRMServices/2007/SPLA/CrmDiscoveryService.asmx";

//Retrieve a list of available organizations from the CrmDiscoveryService Web service.
RetrieveOrganizationsRequest orgRequest = new RetrieveOrganizationsRequest();

HERE I WANT TO PUT THE USERNAME AND PASSWORD FROM THE SIGNIN PAGE
// Substitute an appropriate domain, username, and password here.
orgRequest.UserId = domain + "\\" + username;
orgRequest.Password = password;
RetrieveOrganizationsResponse orgResponse = (RetrieveOrganizationsResponse)disco.Execute(orgRequest);

感谢帮助者:)

1 个答案:

答案 0 :(得分:2)

我假设你在谈论IFD登录页面?您无法从该页面提取用户的凭据。如果您需要用户的凭据,则需要在自定义页面上将其拉入。

您还可以使用UseDefaultCredentials属性来完成orgrequest,该属性将使用当前用户的凭据:

CrmDiscoveryService disco = new CrmDiscoveryService();
disco.Url = "https://localhost/MSCRMServices/2007/SPLA/CrmDiscoveryService.asmx";
disco.UseDefaultCredentials = true;

如果您在自定义页面上执行此操作,则可以使用HttpContext/HttpRequest auth