Tag: microsoft dynamics

使用带有Microsoft Dynamics CRM 2013联机插件的Web服务

我在连接到用于MS Dynamics 2013插件的Web服务时遇到问题(在沙箱模式下运行,因为它在MS托管的在线版本上,而不是内部版本) 我面临的问题是,我似乎无法连接到我需要用来实现我正在尝试做的事情的Web服务。 我最初在app.config中有了web服务绑定,但我很快就知道app.config在这种情况下是无关紧要的(?),所以我继续在代码中创建绑定。 这是我提出的代码: BasicHttpBinding myBinding = new BasicHttpBinding(); myBinding.Name = “BasicHttpBinding_IClientSearch”; myBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.None; myBinding.Security.Transport.ProxyCredentialType = HttpProxyCredentialType.None; myBinding.Security.Message.ClientCredentialType = BasicHttpMessageCredentialType.UserName; myBinding.MaxBufferSize = 524288; myBinding.MaxBufferPoolSize = 524288; myBinding.MaxReceivedMessageSize = 524288; myBinding.ReaderQuotas.MaxDepth = 32; myBinding.ReaderQuotas.MaxArrayLength = 524288; myBinding.ReaderQuotas.MaxStringContentLength = 524288; myBinding.Security.Mode = BasicHttpSecurityMode.TransportWithMessageCredential; EndpointAddress endPointAddress = new EndpointAddress(EndPointURL); ClientSearchService.ClientSearchClient myClient = new ClientSearchService.ClientSearchClient(myBinding, endPointAddress); […]

C#中的Dynamics CRM SDK使用无效密码连接

我正在开发一个C#应用程序,用于从Dynamics CRM Online检索数据。 要validationDynamics CRM的用户名和密码,我使用的是WhoAmIRequest。 它工作正常,直到出现以下情况。 1)使用有效URL,用户名和密码连接Dynamics CRM。 2)处置组织服务对象。 3)使用有效URL,用户名和无效密码重新连接Dynamics CRM。 在这种情况下,WhoAmIRequest也成功执行了。 但它应该失败。 以下是我正在使用的代码: private void button6_Click(object sender, EventArgs e) { CrmConnection connection; string url = “Url=https://mytest.crm.dynamics.com ;Username=mytest@mytest.onmicrosoft.com; Password=goodpassword;”; connection = CrmConnection.Parse(url); OrganizationService orgService = new OrganizationService(connection); Guid userid = ((WhoAmIResponse)orgService.Execute(new WhoAmIRequest())).UserId; if (userid == null) MessageBox.Show(“Login Failed”); else MessageBox.Show(“Login Success”); orgService.Dispose(); url = “Url=https://mytest.crm.dynamics.com […]

检索在optionset字段中选择的值,并在文本字段中显示该值

任何人都可以帮我在文本字段中显示一个optionset字段值..? 我想检索在optionset中选择的值,并使用插件在文本字段中显示相同的值。我在“case”实体的“update”上写这个插件…

无法在插件注册工具中调试动态C#插件

背景 我在Dynamics 2016内部部署了一个C#插件,它使用一个库来调用其他系统。 该库的一部分是使用Web API调用动态。 插件正在采取行动,因为我可以看到动态的变化,但我期待它采取不同于它采取的行动。 当我尝试使用插件注册工具调试插件时,我遇到了一些问题。 当我使用Exception方法分析插件时,我得到一个exception文件,我可以调试到一个点。 当我到达下面的代码时,插件注册工具崩溃而没有错误消息。 当我使用Persist to Entity方法进行调试时,我的插件似乎成功,但插件注册工具中没有记录任何配置文件。 我的插件是从一个动作触发的,该动作是从附加到业务流程流程的工作流程触发的(这是基于本文)。 我最初的问题是在这里导致了这个问题。 有关让调试器使用我的代码的任何想法? 码 HttpClient client = new HttpClient(new HttpClientHandler() { Credentials = new NetworkCredential(“admin”, “password”, “DOMAIN”) }); client.BaseAddress = new Uri(Helpers.GetSystemUrl(COHEN.APIConnector.Application.Dynamics)); client.DefaultRequestHeaders.Clear(); client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue(“application/json”)); client.DefaultRequestHeaders.Add(“OData-MaxVersion”, “4.0”); client.DefaultRequestHeaders.Add(“OData-Version”, “4.0”); HttpResponseMessage responseMessage; string url = “ccseq_clients”; responseMessage = client.GetAsync(url).Result;

如何使用CrmServiceClient设置null属性值

我正在努力使用CrmServiceClient将属性值更新为null。 我的代码适用于非null值,但失败并出现exception: 你调用的对象是空的。 2 Field, AttributeCollection PropertyList) at Microsoft.Xrm.Tooling.Connector.CrmServiceClient.UpdateEntity(String entityName, String keyFieldName, Guid id, Dictionary 2 fieldList,String applyToSolution,Boolean 2 Field, AttributeCollection PropertyList) at Microsoft.Xrm.Tooling.Connector.CrmServiceClient.UpdateEntity(String entityName, String keyFieldName, Guid id, Dictionary中的Microsoft.Xrm.Tooling.Connector.CrmServiceClient.AddValueToPropertyList(KeyValuePair 2 Field, AttributeCollection PropertyList) at Microsoft.Xrm.Tooling.Connector.CrmServiceClient.UpdateEntity(String entityName, String keyFieldName, Guid id, Dictionary enabledDuplicateDetection,Guid batchId) 每当我尝试设置一个空值。 到目前为止,我尝试了以下内容: // create Crm service client object CrmServiceClient svc = […]

在C#插件中调用Dynamics Web API

我在Microsoft Dynamics中有一个业务流程来处理新客户端的创建。 当流程结束时,我附加了一个工作流程,该工作流程可以调用插件来执行某些自定义处理。 我正在按照这篇文章来设置这个过程。 在我的插件中,我调用了Dynamics Web API(请参阅下面的代码)。 当我点击responseMessage = client.GetAsync(url).Result; line,我的插件退出而不返回错误。 当我在插件注册工具中调试时,插件注册工具崩溃并且必须重新启动。 当我查看网络流量时,此呼叫似乎失败了401 – Unauthorized错误。 当我从控制台应用程序尝试同样的HttpClient调用时,调用成功。 我已经尝试了一些不同的凭据进行身份validation而没有成功。 我也尝试过几种不同的方式调用GetAsync函数。 此错误与异步或身份validation方法有关吗? 我在这里想念的是什么? HttpClient client = new HttpClient(new HttpClientHandler() { Credentials = new NetworkCredential(“admin”, “password”, “DOMAIN”) }); client.BaseAddress = new Uri(Helpers.GetSystemUrl(COHEN.APIConnector.Application.Dynamics)); client.DefaultRequestHeaders.Clear(); client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue(“application/json”)); client.DefaultRequestHeaders.Add(“OData-MaxVersion”, “4.0”); client.DefaultRequestHeaders.Add(“OData-Version”, “4.0”); HttpResponseMessage responseMessage; string url = “ccseq_clients”; responseMessage = client.GetAsync(url).Result; 更新 […]