0

I have a PoepleEditor and want to get some additional informations of a selected user from AD. When PoepoleEditor resolves an Entry you have that PickerEntry as result. One member of it is "key" which i probably should use to find the correct user in AD. I use the DirectorySearcher to search through LDAP. My Problem is that there is no attribute i could use to match the key of PickerEntry. The Value of PickerEntry.Key is "abtestportal\Chris" where the LDAP attribute "distinguishedName" of that user returns "CN=Chris,OU=DOM,DC=ab,DC=testportal". The Problem is that DC contains two strings which are concatenated in the key. Does somebody know how to search?

0

I'm not quite sure if I understand you correctly, but I guess you want to extract "abtestportal" from the string "CN=Chris,OU=DOM,DC=ab,DC=testportal".

This could be done with some stringoperations:

    private String GetDcString(String input, String start, String end)
    {
        String result = "";
        while (input.IndexOf(start) > -1)
        {
            input = input.Substring(input.IndexOf(start) + start.Length);
            if (input.IndexOf(end) > 0)
            {
                result += input.Substring(0, input.IndexOf(end));    
            }
            else
            {
                result += input.Substring(0);
            }
        }
        return result;
    }

    private void button1_Click(object sender, EventArgs e)
    {
        String inputstring = "CN=Chris,OU=DOM,DC=ab,DC=testportal";
        String startstring = "DC=";
        String endstring = ",";
        MessageBox.Show(GetDcString(inputstring, startstring, endstring));
        //Messagebox shows "abportal"
    }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.