Binding DirectoryEntry to AD object via GUID

Ask a Question related to ASP.NET Security, Design and Development.

  1. #1

    Default Binding DirectoryEntry to AD object via GUID

    I notice in the help files a reference that implies that you can create a
    DirectoryEntry object that binds directly to an active directory object vai
    it's GUID. The properties where I found this reference are the Guid and
    NativeGuid properties. I cannot locate where or how to do this, the
    DirectoryEntry constructors do not seem to take Guid's nor can you set the
    NativeGuid, so how can I do this? Is it even possible? I'm asking because I
    want to store a link to a user's account infomration in a SQL database so
    that supervisors can manipulate user accounts without browsing the AD tree.
    Thanks
    Gary K Guest

  2. Similar Questions and Discussions

    1. Binding a single object to a control
      Hi all, This probably sounds like a stupid question, but what is generally the recommended way to display a business object in the aspx file for...
    2. Properly binding an object to a custom component.
      I am apparently not doing this. What am I missing to properly bind an object from a repeater looping over an array of object to the custom...
    3. How to binding result from remote object to labelcontrol
      Hi, I have a Remote Object -select query- and I need to display results in a label control. I know that label control don't have dataProvider ...
    4. Binding custom object to a listbox
      I have a class I wish to enter into a listbox public Class AnswerListItem Public Answer As String Public Order As integer End Class Here...
    5. Binding IEnumerable derived object
      This is more of a why question then how. When I bind a key-value collection to a control, I know to set DataTextField and DataValueField to key...
  3. #2

    Default Re: Binding DirectoryEntry to AD object via GUID

    Binding via the GUID is covered here in the docs:

    [url]http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnanchor/html/networkdirectoryserv.asp[/url]

    The examples are for ADSI, but they apply equally well to S.DS.

    Essentially, you can use either the Guid property or the NativeGuid property
    to create the binding string. Guid returns a .NET Guid object and
    NativeGuid returns a string that contains the same Guid in octet string
    format. ADSI accepts either the octet string format or the
    Guid.ToString("D").

    So to create the binding string, you would do either:
    String.Format("LDAP://<{0}>", entry.NativeGuid)
    or
    String.Format("LDAP://<{0}>", entry.Guid.ToString("D"))

    Also, if you get the objectGuid property directly (from either the
    DirectoryEntry or a SearchResult), you can cast that to a byte[] and pass
    that to the Guid constructor to use the second format above.

    Normally, all the S.DS questions are fielded in the adsi.general newsgroup.

    HTH,

    Joe K.

    "Gary K" <GaryK@discussions.microsoft.com> wrote in message
    news:5DE99914-A16A-40FA-9AF7-6B53479735F4@microsoft.com...
    > I notice in the help files a reference that implies that you can create a
    > DirectoryEntry object that binds directly to an active directory object
    vai
    > it's GUID. The properties where I found this reference are the Guid and
    > NativeGuid properties. I cannot locate where or how to do this, the
    > DirectoryEntry constructors do not seem to take Guid's nor can you set the
    > NativeGuid, so how can I do this? Is it even possible? I'm asking because
    I
    > want to store a link to a user's account infomration in a SQL database so
    > that supervisors can manipulate user accounts without browsing the AD
    tree.
    > Thanks

    Joe Kaplan \(MVP - ADSI\) Guest

  4. #3

    Default Re: Binding DirectoryEntry to AD object via GUID

    Thanks for that, sorry about the mispost.

    "Joe Kaplan (MVP - ADSI)" wrote:
    > Binding via the GUID is covered here in the docs:
    >
    > [url]http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnanchor/html/networkdirectoryserv.asp[/url]
    >
    > The examples are for ADSI, but they apply equally well to S.DS.
    >
    > Essentially, you can use either the Guid property or the NativeGuid property
    > to create the binding string. Guid returns a .NET Guid object and
    > NativeGuid returns a string that contains the same Guid in octet string
    > format. ADSI accepts either the octet string format or the
    > Guid.ToString("D").
    >
    > So to create the binding string, you would do either:
    > String.Format("LDAP://<{0}>", entry.NativeGuid)
    > or
    > String.Format("LDAP://<{0}>", entry.Guid.ToString("D"))
    >
    > Also, if you get the objectGuid property directly (from either the
    > DirectoryEntry or a SearchResult), you can cast that to a byte[] and pass
    > that to the Guid constructor to use the second format above.
    >
    > Normally, all the S.DS questions are fielded in the adsi.general newsgroup.
    >
    > HTH,
    >
    > Joe K.
    >
    > "Gary K" <GaryK@discussions.microsoft.com> wrote in message
    > news:5DE99914-A16A-40FA-9AF7-6B53479735F4@microsoft.com...
    > > I notice in the help files a reference that implies that you can create a
    > > DirectoryEntry object that binds directly to an active directory object
    > vai
    > > it's GUID. The properties where I found this reference are the Guid and
    > > NativeGuid properties. I cannot locate where or how to do this, the
    > > DirectoryEntry constructors do not seem to take Guid's nor can you set the
    > > NativeGuid, so how can I do this? Is it even possible? I'm asking because
    > I
    > > want to store a link to a user's account infomration in a SQL database so
    > > that supervisors can manipulate user accounts without browsing the AD
    > tree.
    > > Thanks
    >
    >
    >
    Gary K Guest

  5. #4

    Default Re: Binding DirectoryEntry to AD object via GUID

    No need to apologize. It is pretty unobvious where to post S.DS questions
    unless you already know :) MS has so far rejected my requests for an S.DS
    newsgroup which would help with this. I was just trying to spread the word
    in case you had follow ups.

    Joe K.

    "Gary K" <GaryK@discussions.microsoft.com> wrote in message
    news:B3BA8DCB-B1C0-4A19-BA5C-FB7B904BD1E3@microsoft.com...
    > Thanks for that, sorry about the mispost.
    >

    Joe Kaplan \(MVP - ADSI\) Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139