I wanted to create a custom asp.net WebApi that should communicate with office365 SharePoint 2013 site.
In GET Method, I wrote a below code snippet and hosted to local IIS(Executed from VS 2012) and its communicating with SharePoint site smoothly. If I host the same Webapi to windows Azure, Client context is not initializing with the below code. Does it requires any Token services ? If yes, how to generate custom access token ?
ClientContext clientContext = new ClientContext("siteUrl");
SecureString secureString = new SecureString();
string password = "password";
foreach (char c in password)
secureString.AppendChar(c);
clientContext.Credentials = new SharePointOnlineCredentials(userName, secureString);
clientContext.ExecuteQuery();