Tag: dynamics crm

如何查询所有现有字段的元数据

我们希望客户端能够发布到端点,例如: [Route(“Account”, Name = “CreateAccount”, Order = 1)] [HttpPost] public Account CreateAccount([FromBody] Account account) { var newAccount = _accountService.CreateAccountEntity(account); return newAccount; } 我们知道这可以做到: POST [Organization URI]/api/data/v8.2/accounts HTTP/1.1 Content-Type: application/json; charset=utf-8 OData-MaxVersion: 4.0 OData-Version: 4.0 Accept: application/json { “name”: “Sample Account”, “creditonhold”: false, “address1_latitude”: 47.639583, “description”: “This is the description of the sample account”, “revenue”: 5000000, […]

如何解决Dynamics CRM插件System.Security.Permissions.FileIOPermission错误

业务流程错误 System.Security.SecurityException:请求类型为’ System.Security.Permissions.FileIOPermission ,mscorlib,Version = 4.0.0.0,Culture = neutral,PublicKeyToken = b77a5c561934e089’的权限失败。 System.Security上的System.Security.CodeAccessSecurityEngine.Check(Object demand,StackCrawlMark和stackMark,Boolean isPermSet)处于System.IO.FileStream.Init的System.Security.CodeAccessPermission.Demand()处(字符串路径,FileMode模式,FileAccess访问,Int32权限,布尔值) System.IO.FileStream..ctor中的useRights,FileShare共享,Int32 bufferSize,FileOptions选项,SECURITY_ATTRIBUTES secAttrs,String msgPath,Boolean bFromProxy,Boolean useLongPath,Boolean checkHost)(字符串路径,FileMode模式,FileAccess访问,FileShare共享,Int32 bufferSize ,FileOptions选项,String msgPath,Boolean bFromProxy,Boolean useLongPath,Boolean checkHost)at System.IO.File.InternalWriteAllBytes(String path,Byte [] bytes,Boolean checkHost)at RetrieveAttachments.RetrieveClass.Execute(IServiceProvider serviceProvider)失败的操作是:需要失败的第一个权限的类型是:System.Security.Permissions.FileIOPermission失败的程序集区域是:MyComputer 我还在插件AssemblyInfo.cs文件[assembly:System.Security.AllowPartiallyTrustedCallers]中添加了以下方法,但它引发了同样的错误。 QueryExpression notes = new QueryExpression { EntityName = “annotation”, ColumnSet = new ColumnSet(“filename”, “subject”, “annotationid”, “documentbody”,”mimetype”) }; notes.Criteria.AddCondition(“annotationid”, ConditionOperator.Equal, annotationid); EntityCollection […]

如何为自定义实体提供多个条目?

在我们的Dynamics CRM在线自定义项目中 – 我们在名为DocProject的表单的自定义实体中有默认的ACTIVITIES选项卡 ACTIVITIES能够进行多次参赛 。 此外,还有相同forms的NOTES选项卡 NOTES也可以输入多个条目 。 哦,这是由Dynamics CRM人员完成的。 到现在为止还挺好。 在相同的表单中,我们还为自定义实体DocProjectActivities提供了DocProjectActivities 查找字段 这是一个查找字段, 因此它具有1:N的关系 。 澄清:我们的问题不仅仅与活动有关。 WKT Notes的行为也相似。 我们只需要一些config ,这将允许我们为一个字段创建多个条目 问题: 如何确保此自定义实体DocProjectActivities允许多个条目作为ACTIVITIES & NOTES ?

无法在插件注册工具中调试动态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; 更新 […]

批量请求 – Dynamics CRM

所有, 我正在尝试使用以下源代码向Dynamics CRM实施批处理请求: public async Task HttpPatchCrmApi(string resource, string data) { string uniq = Guid.NewGuid().ToString(); MultipartContent content = new MultipartContent(“mixed”, “batch_” + uniq); HttpRequestMessage batchRequest = new HttpRequestMessage(HttpMethod.Post, CrmBaseUrl + “/api/data/v8.0/$batch”); HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Post, CrmBaseUrl + resource); request.Content = new StringContent(data, Encoding.UTF8, “application/json”); HttpMessageContent query = new HttpMessageContent(request); content.Add(query); batchRequest.Content = content; HttpResponseMessage […]

使用OrderClose类时无法编译代码

我正在尝试构建一个在销售订单上执行某些操作的插件。 我还必须将订单设置为已履行。 我在SDK文档中找到了必须用于以正确方式完成订单的提取 var request = new FulfillSalesOrderRequest { OrderClose = new OrderClose { SalesOrderId = new EntityReference { LogicalName = orderEntityName, Id = orderId } }, Status = new OptionSetValue(newStatus) }; 问题是代码无法编译,因为MVS说“无法找到类型或命名空间名称’OrderClose’(你是否缺少using指令或程序集引用?)”。 右键单击“new OrderClose”(OrderClose带有红色下划线)我看不到菜单中的Resolve部分。 我也尝试过这种方式: var request = new FulfillSalesOrderRequest(); request.OrderClose = new OrderClose(); request.OrderClose.LogicalName = orderEntityName; request.OrderClose.Id = orderId; request.Status = new OptionSetValue(newStatus); […]

在服务器端更新字段后,防止触发OnChange函数

当我将OnChange函数注册到字段时,如果在服务器端的插件上更新字段,则会触发它(On Dynamics Crm 2015) 是否可以阻止此行为(以受支持的方式)? 示例代码: 1.客户方: Xrm.Page.getAttribute(“org_myfield”).addOnChange(function () { alert(“org_myfield was changed”) }); 2.服务器端: internal void OnPreUpdateRequest(org_myentity target, org_myentity preImage) { target.org_myfield = “some value”; } 3.结果 (保存记录和插件完成运行后): “org_myfield was changed” 必需结果:不应触发警报。

ExecuteMultipleResponse; 如何从rest中读取和存储Guids

我正在使用ExecuteMultipleResponse方法使用SSIS一次插入10个帐户记录。 List _Accounts = new List(); // Check the batch size and process public override void InputAccount_ProcessInput(InputAccountBuffer Buffer) { //List personIDs = new List(); int index = 0; while (Buffer.NextRow()) { _Accounts.Add(InputAccountFromBuffer(Buffer)); //personIDs.Add(int.Parse(Buffer.sPersonID)); index++; if (index == 10) { ImportBatch(); index = 0; } } ImportBatch(); } private void ImportBatch() { if (_Accounts.Count > 0) […]