Hey monkeys,
I have a problem.
I'm trying to get a response of a request to an Sharepoint Rest Api.
On a Console Application, my code run as well but on Xamarin.Forms it does not end GetResponseAsync().
My code:
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create("MyUri");
request.Method = "GET";
request.Accept = "application/json;odata=verbose";
request.Credentials = new NetworkCredential(user, pass, domain);
string ResultStream = "";
try
{
using (WebResponse response = await request.GetResponseAsync())
{
using (Stream responseStream = response.GetResponseStream())
{
using (StreamReader reader = new StreamReader(responseStream))
{
ResultStream = reader.ReadToEnd();
var obj = Newtonsoft.Json.Linq.JObject.Parse(ResultStream);
var x = obj["results"];
x = x;
}
}
}
}
catch (Exception e)
{
throw;
}
Can anyone help me?