I want to check if a folder exists in sharepoint. But it could be any folder hosted in IIS.
Does Directory.Exists work? If not...
I found this method below, but it only creates the folder, no check to see if it already exists or not, does anyone have some working code to check if the folder exists?:
private bool CreateFolder(string folderURL)
{
try
{
WebRequest request = WebRequest.Create(folderURL);
request.Credentials = m_credentials;
request.Method = "MKCOL";
WebResponse response = request.GetResponse();
response.Close();
return true;
}
catch (WebException)
{
return false;
}
}