【发布时间】:2013-12-23 23:48:43
【问题描述】:
我只是说要学习 xRM。大多数时候,我将在我的工作网络之外工作。 (由于许多原因,我们的 VPS 并不总是按预期工作)
我通常可以使用 IFD 从我的个人 PC 连接到我们的 CRM。我想知道的是,我可以从我们的网络外部使用组织服务吗?如果是,你知道任何例子吗?还是与 MS CRM 网站上描述的标准方式相同?
谢谢
【问题讨论】:
标签: c# dynamics-crm-2011 dynamics-crm
我只是说要学习 xRM。大多数时候,我将在我的工作网络之外工作。 (由于许多原因,我们的 VPS 并不总是按预期工作)
我通常可以使用 IFD 从我的个人 PC 连接到我们的 CRM。我想知道的是,我可以从我们的网络外部使用组织服务吗?如果是,你知道任何例子吗?还是与 MS CRM 网站上描述的标准方式相同?
谢谢
【问题讨论】:
标签: c# dynamics-crm-2011 dynamics-crm
为了满足未来的 Andrii 的回答,这里是链接文章中的示例代码:
Uri organizationUriIFD = new Uri("https://[server]:[port]/XRMServices/2011/Organization.svc");
ClientCredentials credentials = new ClientCredentials();
credentials.UserName.UserName = "username";
credentials.UserName.Password = "password";
IServiceConfiguration<IOrganizationService> config = ServiceConfigurationFactory.CreateConfiguration<IOrganizationService>(organizationUriIFD);
using (Microsoft.Xrm.Sdk.Client.OrganizationServiceProxy _serviceProxy = new OrganizationServiceProxy(config, credentials))
{
// This statement is required to enable early-bound type support.
_serviceProxy.ServiceConfiguration.CurrentServiceEndpoint.Behaviors.Add(new ProxyTypesBehavior());
IOrganizationService _service = (IOrganizationService)_serviceProxy;
WhoAmIResponse response = (WhoAmIResponse)_service.Execute(new WhoAmIRequest());
Console.WriteLine(response.UserId.ToString());
Console.ReadLine();
}
【讨论】: