listing Object properties from SearchResult

dl
Date: 05/13/05


Date: Fri, 13 May 2005 14:48:32 +0800

Hi
I have the following lines of code that are suppose to list some selected
properties of all the object entries in a SearchResult but the code is only
listing one property ie. the 'sn' and the corresponding value for all the
entries, do you have a clue why?
TIA
----------------------
            foreach (SearchResult resEnt in resEntAll)
            {
                i++;
                dr = dt.NewRow();
                foreach (string propKy in resEnt.Properties.PropertyNames)
                {
                    switch (propKy)
                    {
                        case "sn":
                            y = 0;
                            break;
                        case "givenName":
                            y = 1;
                            break;
                        case "telephoneNumber":
                            y = 2;
                            break;
                        default:
                            y = 3;
                            break;
                    }
                    if (y < 3)
                    {
                        ResultPropertyValueCollection valco =
resEnt.Properties[propKy];
                        foreach (Object prop in valco)
                        {
                            dr[y] = prop.ToString();
                        }
                    }
                }
                dt.Rows.Add(dr);
            }

--