CRMエンティティを別のエンティティからのルックアップ値で更新するCRM Web API呼び出しを行った人は誰ですか?WebAPIを使用してCRMルックアップ値を設定する
WebAPI、CRM 2016を使用して、CRM内の別のエンティティにルックアップ値を設定しようとしています。ルックアップ値を無効にすると機能しますが、ルックアップ値を有効にすると、
以下はLinqPadのコードですので動作します。
void Main()
{
using(var webClient = new WebClient()){
webClient.Credentials = new NetworkCredential("Username", "Password", "Domain");
webClient.Headers.Add("OData-MaxVersion", "4.0");
webClient.Headers.Add("OData-Version", "4.0");
webClient.Headers.Add("accept", "application/json");
webClient.Headers.Add("Content-Type","application/json");
webClient.Headers.Add("Prefer", "odata.include-annotations=*");
webClient.BaseAddress = "http://dev.company.com/DEV2016/api/data/v8.0/";
var JO = new JObject();
JO.Add("col_name","My Name");
//JO.Add("[email protected]","/contacts(7266f26b-7105-e611-811e-005056b61789)");
var dataString = JO.ToString();
var responseString = webClient.UploadString("col_advisors", "POST", dataString);
Console.WriteLine(webClient.ResponseHeaders.Get("OData-EntityId"));
}
}