I have to create a folder in sharepoint using a plugin in CRM Online, I did this method but I have an error : the remote server returned an error (403) forbidden My credentials are correct and I have the rights to create a folder. I can do that from a browser.
Thanks for help.
private void CreateFolderInSharepoint(string folderUrl, ITracingService trace)
{
try
{
System.Net.NetworkCredential myCredential = new System.Net.NetworkCredential("username", "password");
WebRequest request = WebRequest.Create(folderUrl);
request.Credentials = myCredential;
request.Method = "MKCOL";
WebResponse response = request.GetResponse();
response.Close();
}
catch (Exception ex)
{
trace.Trace(ex.ToString());
}
}