Currently, two versions are supported for the Office 365 Mail, Calendar, and Contacts APIs: v1andv2
About REST API v2
Office 365 API Azure Active Directory (Azure AD) Office 365. Azure AD OAuth 2.0.
API- Office 365, Azure AD.
API v1, Basic, , , :
class Program
{
static void Main(string[] args)
{
ReadContacts().Wait();
}
private static async Task ReadContacts()
{
var handler = new HttpClientHandler();
handler.Credentials = new NetworkCredential()
{
UserName = ConfigurationManager.AppSettings["UserName"],
Password = ConfigurationManager.AppSettings["Password"]
};
using (var client = new HttpClient(handler))
{
var url = "https://outlook.office365.com/api/v1.0/me/contacts";
var result = await client.GetStringAsync(url);
var data = JObject.Parse(result);
foreach (var item in data["value"])
{
Console.WriteLine(item["DisplayName"]);
}
}
}
}