I am getting the exception (System.DirectoryServices.DirectoryServicesCOMException (0x8007202B): A referral was returned from the server.) while trying to read the manager's display name from Active Directory.
Exception Snapshot:
The exception is occurring while doing the following check,
if (grp != null && grp.Properties != null && grp.Properties["displayname"] != null && grp.Properties["displayname"].Value != null)
Code:
if (foundEntry.Properties["manager"] != null && foundEntry.Properties["manager"].Value != null)
{
DirectoryEntry grp = new DirectoryEntry("LDAP://" + foundEntry.Properties["manager"].Value);
if (grp != null && grp.Properties != null && grp.Properties["displayname"] != null && grp.Properties["displayname"].Value != null)
{
adresult.SupervisorName = grp.Properties["displayname"].Value.ToString();
}
}
Group Property
When I debug grp.Properties, I am seeing the following:
Am I missing anything? What could be the cause of this issue?
I appreciate any suggestions.
User contributions licensed under CC BY-SA 3.0