我正在尝试执行以下 API 调用
RetrieveRecordChangeHistoryRequest
我正在尝试按照这些步骤操作,但我无法复制代码,我得到了一堆错误。
我已成功安装 Dynamics 365 HelperCode,但开始管理我不明白为什么不起作用的代码。(我在 C# 方面有 0 经验)
using Microsoft.Crm.Sdk.Samples.HelperCode;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System.Net.Http;
using System.Net.Http.Headers;
private HttpClient httpClient;
private void ConnectToCRM(String[] cmdargs)
{
Configuration config = null;
if (cmdargs.Length > 0)
config = new FileConfiguration(cmdargs[0]);
else
config = new FileConfiguration(null);
Authentication auth = new Authentication(config);
httpClient = new HttpClient(auth.ClientHandler, true);
httpClient.BaseAddress = new Uri(config.ServiceUrl + "api/data/v8.1/");
httpClient.Timeout = new TimeSpan(0, 2, 0);
httpClient.DefaultRequestHeaders.Add("OData-MaxVersion", "4.0");
httpClient.DefaultRequestHeaders.Add("OData-Version", "4.0");
httpClient.DefaultRequestHeaders.Accept.Add(
new MediaTypeWithQualityHeaderValue("application/json"));
}
Program app = new Program();
try
{
String[] arguments = Environment.GetCommandLineArgs();
app.ConnectToCRM(arguments);
}
catch (System.Exception ex)
{ ; }
finally
{
if (app.httpClient != null)
{ app.httpClient.Dispose(); }
}
private static void DisplayException(Exception ex)
{
Console.WriteLine("The application terminated with an error.");
Console.WriteLine(ex.Message);
while (ex.InnerException != null)
{
Console.WriteLine("\t* {0}", ex.InnerException.Message);
ex = ex.InnerException;
}
}
错误