Fix Organizational Provider error on Build.

This commit is contained in:
Virtuworks 2013-02-07 07:50:09 -05:00
parent adbedd8d26
commit 1e788eac8e

View file

@ -754,49 +754,6 @@ namespace WebsitePanel.Providers.HostedSolution
public bool DoesSamAccountNameExist(string accountName)
{
return DoesSamAccountNameExistInternal(accountName);
}
private bool DoesSamAccountNameExistInternal(string accountName)
{
HostedSolutionLog.LogStart("DoesSamAccountNameExistInternal");
HostedSolutionLog.DebugInfo("sAMAccountName : {0}", accountName);
bool bFound = false;
try
{
string path = GetRootOU();
HostedSolutionLog.DebugInfo("Search path : {0}", path);
DirectoryEntry entry = ActiveDirectoryUtils.GetADObject(path);
DirectorySearcher searcher = new DirectorySearcher(entry);
searcher.PropertiesToLoad.Add("sAMAccountName");
searcher.Filter = "(sAMAccountName=" + accountName + ")";
searcher.SearchScope = SearchScope.Subtree;
SearchResult resCollection = searcher.FindOne();
if (resCollection != null)
{
if (resCollection.Properties["samaccountname"] != null)
bFound = true;
}
}
catch (Exception e)
{
HostedSolutionLog.DebugInfo("Failed : {0}", e.Message);
}
HostedSolutionLog.DebugInfo("DoesSamAccountNameExistInternal Result: {0}", bFound);
HostedSolutionLog.LogEnd("DoesSamAccountNameExistInternal");
return bFound;
}
#endregion
#region Domains