Here is the error I get:
Cannot initialize type 'HttpClientHandler' with a collection initializer because it does not implement 'System.Collections.IEnumerable'
Code:
using System;
using System.Net;
using System.Net.Http;
namespace Sharepoint_2013_REST_API
{
public class Program
{
public void Main(string[] args)
{
//Init
string baseURL = "";
string uriString = "";
string User = "";
string Password = "";
string Domain = "";
System.Net.Http.HttpClient _Client = new System.Net.Http.HttpClient();
_Client.BaseAddress = new Uri(baseURL);
HttpResponseMessage resp = _Client.GetAsync(uriString).Result;
string respString = resp.Content.ReadAsStringAsync().Result;
_Client = new System.Net.Http.HttpClient(new HttpClientHandler() { new NetworkCredential(User, Password, Domain)});
if (resp.StatusCode != HttpStatusCode.OK)
{
Console.Write("Status code: " + resp.StatusCode);
Console.ReadLine();
}
}
}
}
Hope you can help me resolve this error?