1

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());
        }
    }
sadzag
  • 73
  • 8
  • Your not spcifying which webservice to connect to, your also not specifying what the folder to create is. the `Create()` method is used to create a new instance of the web request, to the URI of the webservice. at no point are you actually calling the webservice either. – Nikerym Nov 06 '15 at 04:01
  • I used the same code as here http://stackoverflow.com/questions/1630824/sharepoint-how-to-create-a-folder-in-a-document-library-please-using-web-servic – sadzag Nov 12 '15 at 15:01

1 Answers1

-1

Refer to this

www.wictorwilen.se/.../How-to-do-active-authentication-to-Office-365-and-SharePoint-Online.aspx

sadzag
  • 73
  • 8