Re: casting type for objectGuid

From: Joe Kaplan \(MVP - ADSI\) (joseph.e.kaplan_at_removethis.accenture.com)
Date: 05/27/05

  • Next message: robin9876_at_hotmail.com: "Disable Stack trace sent to client"
    Date: Fri, 27 May 2005 09:48:05 -0500
    
    

    In AD/S.DS, objectGUID is returned from a DirectoryEntry or SearchResult as
    a byte array. You would want to cast that to a byte array, then pass that
    byte array to the constructor on a Guid structure. That will give you a
    valid .NET Guid.

    I can't remember the exact syntax to pass it into SQL to get it set up as a
    UniqueIdentifier column (which is the correct SQL type for a GUID), but as I
    recall, you pass it in your query as a String. Call the ToString method on
    the Guid to get this.

    HTH,

    Joe K.

    <dl> wrote in message news:Olh5aApYFHA.3220@TK2MSFTNGP14.phx.gbl...
    > Hi
    > I am trying to put a user's objectGuid as the primary key onto a datatable
    > and be used as the unique key on editing / updating. But I seem to get
    > casting error with the following statement
    > dt.Columns.Add(new DataColumn("object_Guid", typeof(string)));
    >
    > Any idea?
    >
    > TIA
    >
    > --
    >
    >
    >


  • Next message: robin9876_at_hotmail.com: "Disable Stack trace sent to client"

    Relevant Pages

    • Re: How can I access more properties of the AD Acount
      ... The Guid structure in .NET does all of the heavy lifting for you. ... When you read the objectGUID from AD has byte array, ...
      (microsoft.public.dotnet.security)
    • Re: Get currently logged in users ojectGUID
      ... I am looking to find a way to get currently logged in user's object GUID without querying ActiveDirectory. ... For example, when i log in to my laptop from home, I'm not on the office network so i can't reach AD but I'm sure i still can get my AD's objectGUID, as the profile is cached locally. ... Our application currently supports its own set of application users/logins, but it becomes a problem for our bigger clients who want all of their software to be "One click login" so that once you are logged in to Windows, you have access to all apps without need to login again using those apps' logins. ... Like in SQL server you can login using sql account or using windows authentication. ...
      (microsoft.public.dotnet.languages.csharp)
    • Re: Convert a String to GUID
      ... The value of objectGuid is set by the system and cannot be modified. ... >> GUID's are stored in OctetString syntax, which is a byte array. ... to a hex string form. ... >> The opposite conversion is possible in VBScript. ...
      (microsoft.public.scripting.wsh)
    • Re: Get currently logged in users ojectGUID
      ... I am looking to find a way to get currently logged in user's object GUID without querying ActiveDirectory. ... For example, when i log in to my laptop from home, I'm not on the office network so i can't reach AD but I'm sure i still can get my AD's objectGUID, as the profile is cached locally. ... Our application currently supports its own set of application users/logins, but it becomes a problem for our bigger clients who want all of their software to be "One click login" so that once you are logged in to Windows, you have access to all apps without need to login again using those apps' logins. ...
      (microsoft.public.dotnet.languages.csharp)
    • Re: How can I access more properties of the AD Acount
      ... each byte is converted into a hex string of two letters and gets an ... >I found some help on converting the objectGUID Attribute of an AD Object to ... > GUID through the GUID Structure in .NET Framework but when i try to search ...
      (microsoft.public.dotnet.security)