亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

如何使用 CrmServiceClient 設置空屬性值

如何使用 CrmServiceClient 設置空屬性值

C#
Cats萌萌 2021-06-22 17:12:54
我正在努力使用 CrmServiceClient 將屬性值更新為 null。我的代碼對于非空值工作正常,但因異常而失?。耗阏{用的對象是空的。在 Microsoft.Xrm.Tooling.Connector.CrmServiceClient.AddValueToPropertyList(KeyValuePair 2  Field, AttributeCollection PropertyList)      at  Microsoft.Xrm.Tooling.Connector.CrmServiceClient.UpdateEntity(String  entityName, String keyFieldName, Guid id, Dictionary2 fieldList, String applyToSolution, Boolean enabledDuplicateDetection, Guid batchId)每當我嘗試設置空值時。到目前為止,我已經嘗試了以下方法:// create Crm service client objectCrmServiceClient svc = new CrmServiceClient(new System.Net.NetworkCredential("username", "password", "domain"),                "crmhost",                "443",                "crmorganization",                false,                true                );// check the connection to CRM was successfulif (!svc.IsReady){    throw new Exception("Could not connect to CRM Organization.", svc.LastCrmException);}// create a Dictionary to store the attributes to be added to the entityDictionary<string, CrmDataTypeWrapper> attributes = new Dictionary<string, CrmDataTypeWrapper>();//this doesn't workattributes.Add("new_somedatefield", null);// and this doesn't workattributes.Add("new_somedatefield", new CrmDataTypeWrapper(null, CrmFieldType.CrmDateTime));// this also doesn't workDateTime? nullDate = new DateTime();nullDate = null;attributes.Add("new_somedatefield", new CrmDataTypeWrapper(nullDate, CrmFieldType.CrmDateTime));svc.UpdateEntity("new_entityname", "new_entitynameid", (Guid)data[metaData.PrimaryIdAttribute], attributes));文檔中沒有特別提到設置空值。有沒有人成功地實現了這一目標?編輯 - 為了澄清我需要針對 Dynamics CRM 2015,CrmServiceClient 上的 Update 方法直到 2016 年才可用。
查看完整描述

1 回答

  • 1 回答
  • 0 關注
  • 186 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號