Bonjour;
désoler mais meme avec tous c lien je ne vois pas comment faire pour créé un dossier public en c#...
j'ai trouver se code mais il ne foncitonne pas...
// Variables. System.Net.HttpWebRequest Request; System.Net.WebResponse Response; System.Net.CredentialCache MyCredentialCache; string strFolderURI = "http://exchdev.domaine.local/public/"; string strUserName = "Administrateur"; string strPassword = "*********"; string strDomain = "domaine.local";
try { // Create a new CredentialCache object and fill it with the network // credentials required to access the server. MyCredentialCache = new System.Net.CredentialCache(); MyCredentialCache.Add(new System.Uri(strFolderURI), "NTLM", new System.Net.NetworkCredential(strUserName, strPassword, strDomain) );
// Create the HttpWebRequest object. Request = (System.Net.HttpWebRequest)HttpWebRequest.Create(strFolderURI);
// Add the network credentials to the request. Request.Credentials = MyCredentialCache;
// Specify the MKCOL method. Request.Method = "MKCOL";
// Send the MKCOL method request, get the // method response from the server. Response = (System.Net.HttpWebResponse)Request.GetResponse();
// Close the HttpWebResponse object. Response.Close();
MessageBox.Show("Folder created at " + strFolderURI + ".");
} catch (Exception ex) { // Catch any exceptions. Any error codes from the MKCOL // method request on the server will be caught here, also. MessageBox.Show(ex.Message);
}
il me retourne: (401) non autorisé
|