Forum Search:
Forum.Brain-Cluster.com: Brain Cluster Technical Forum
Ultimate forum for Technical Discussions

Home » Microsoft » Windows Server » Active Directory » ldap query with guid
ldap query with guid [message #156443] Wed, 17 June 2009 05:50 Go to next message
ANONYMOUS  is currently offline ANONYMOUS  Sweden
Messages: 273
Registered: July 2009
Senior Member
How do I specify a ldap query with a filter for a guid?

I want to query for the property "msexchmailboxguid", I think this value
might be of type "16 bytes array", not "guid", which might make it hard to
specify in a query tool.

query with a filter like:
(displayname=John Doe)
does work, but the filter:
(msexchmailboxguid={12345678-1234-1234-1234-123412341234})
doesn't return any AD object.
Re: ldap query with guid [message #156451 is a reply to message #156443] Wed, 17 June 2009 10:04 Go to previous message
rlmueller-nospam  is currently offline rlmueller-nospam  United States
Messages: 292
Registered: July 2009
Senior Member
"Anonymous" <billg@microsoft.com> wrote in message
news:Og4$JEz7JHA.4404@TK2MSFTNGP04.phx.gbl...
> How do I specify a ldap query with a filter for a guid?
>
> I want to query for the property "msexchmailboxguid", I think this value
> might be of type "16 bytes array", not "guid", which might make it hard to
> specify in a query tool.
>
> query with a filter like:
> (displayname=John Doe)
> does work, but the filter:
> (msexchmailboxguid={12345678-1234-1234-1234-123412341234})
> doesn't return any AD object.

I believe you must use the hex format for the guid, then escape the hex
characters. For example if the objectGUID is
"{B95F3990-B59A-4A1B-9E96-86C66CB18D99}", the hex format is
"90395FB99AB51B4A9E9686C66CB18D99", and you would use:

" (objectGUID=\90\39\5F\B9\9A\B5\1B\4A\9E\96\86\C6\6C\B1\8D\99 ) "

The tricky part is converting from the display format with curly braces and
dashes into the hex format. You can get the idea from my example. Remove all
curly braces and dashes and reverse the bytes in each group (delimited by
dashes) except the last group.

--
Richard Mueller
MVP Directory Services
Hilltop Lab - http://www.rlmueller.net
--
Re: ldap query with guid [message #156455 is a reply to message #156443] Wed, 17 June 2009 09:56 Go to previous message
Joe Kaplan  is currently offline Joe Kaplan  United States
Messages: 88
Registered: July 2009
Member
See if this filter works for that GUID:

msExchMailboxGUID=\78\56\34\12\34\12\34\12\12\34\12\34\12\34 \12\34

If that does, then it is just a case of needing to convert the COM style
string format GUID to binary format and then prefixing each byte with a \.
I have a tool on my site in the files section of directoryprogramming.net
called GUIDConverter that simplifies the conversion of GUIDs to formats that
are useful in LDAP and also discuss how this stuff works in some detail in
my book.

HTH!

--
Joe Kaplan-MS MVP Directory Services Programming
Co-author of "The .NET Developer's Guide to Directory Services Programming"
http://www.directoryprogramming.net
"Anonymous" <billg@microsoft.com> wrote in message
news:Og4$JEz7JHA.4404@TK2MSFTNGP04.phx.gbl...
> How do I specify a ldap query with a filter for a guid?
>
> I want to query for the property "msexchmailboxguid", I think this value
> might be of type "16 bytes array", not "guid", which might make it hard to
> specify in a query tool.
>
> query with a filter like:
> (displayname=John Doe)
> does work, but the filter:
> (msexchmailboxguid={12345678-1234-1234-1234-123412341234})
> doesn't return any AD object.
Previous Topic:sid's and sid history
Next Topic:newbie: Moving DC to remote location?
Goto Forum:
  


Current Time: Sat Oct 21 19:01:10 EDT 2017

Total time taken to generate the page: 0.02953 seconds
.:: Contact :: Home ::Sitemap::.

Powered by: FUDforum 3.0.0RC2.
Copyright ©2001-2009 FUDforum Bulletin Board Software