public static void Main() { DsBrowseInfo dsbi = new DsBrowseInfo { Size = Marshal.SizeOf(typeof(DsBrowseInfo)), PathSize = DsBrowseInfo.MAX_PATH, Caption = "Container Selection Example", Title = "Select a container from the list.", ReturnFormat = NativeMethods.ADS_FORMAT_WINDOWS, Flags = NativeMethods.DSBI_ENTIREDIRECTORY, Root = "LDAP:", Path = new string(new char[DsBrowseInfo.MAX_PATH]) }; // Initialize remaining members... int status = NativeMethods.DsBrowseForContainerW(ref dsbi); if ((NativeMethods.BrowseStatus)status == NativeMethods.BrowseStatus.BrowseOk) { Console.WriteLine(dsbi.Path); } else { Console.WriteLine("No path returned."); } }
public static void Main() { DsBrowseInfo dsbi = new DsBrowseInfo(); dsbi.Size = Marshal.SizeOf(typeof(DsBrowseInfo)); dsbi.PathSize = DsBrowseInfo.MAX_PATH; dsbi.Caption = "Container Selection Example"; dsbi.Title = "Select a container from the list."; dsbi.ReturnFormat = LibWrap.ADS_FORMAT_WINDOWS; dsbi.Flags = LibWrap.DSBI_ENTIREDIRECTORY; dsbi.Root = "LDAP:"; dsbi.Path = new string(new char[DsBrowseInfo.MAX_PATH]); // Initialize remaining members... int status = LibWrap.DsBrowseForContainerW(ref dsbi); if ((LibWrap.BrowseStatus)status == LibWrap.BrowseStatus.BrowseOk) { Console.WriteLine(dsbi.Path); } else { Console.WriteLine("No path returned."); } }
internal static extern int DsBrowseForContainerW(ref DsBrowseInfo info);