-1
私はCRM on premise 2016に接続してデータを取得するためにこのコードを書いています。CRM 2016 api無許可アクセス
ここでは、
var credentials = new NetworkCredential("username", "password?", "domain");
var client = new HttpClient(new HttpClientHandler() { Credentials = credentials })
{
BaseAddress = new Uri("https://xxxtestenv.elluciancrmrecruit.com/api/data/v8.0/")
};
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
var response = client.GetAsync("datatel_events?$orderby=datatel_eventname").Result;
if (response.IsSuccessStatusCode)
{
var yourcustomobjects = response.Content.ReadAsStringAsync();
}
だが、私は
response {StatusCode: 401, ReasonPhrase: 'Unauthorized', Version: 1.1, Content: System.Net.Http.StreamContent, Headers:
{ REQ_IDこのエラーが出る:b685b007-199b-4a4a-85cc-3a29684e5588 日:木、2016年9月22日19: 27:35 GMT サーバー:マイクロソフト-IIS/8.5 WWW認証:ネゴシエート WWW認証:NTLM X -Poweredバイ:ASP.NET 接続:キープアライブ のContent-Length:49 のContent-Type:text/plainの }} System.Net.Http.HttpResponseMessage
任意の提案ですか?
それはIFDが有効ですか? –
はい、どこからでもアクセスできます。私は、httpclientがcrmにログインするために使用する別のリンクへのリダイレクトリンクを持っているコードをデバッグするときに見つけました。これはあなたにとって正常ですか? –