none
AD SearchResult - UserAccountControl Attribute Type RRS feed

  • Question

  • Hi All,

    Yesterday i had an issue concerning a UserAccountControl Attribute on a SearchResult object, currently this issue is gone, however i would like to have some input, concerning future problems.

    During the development of my app i checked that UserAccountControl Attribute has a Integer Type, however yestarday i had an diferent Type returned (Array of Bytes), this was a temporary behaviour.

    You can check the watches on the screens bellow.

    Returning Integer Type:

    Returning Array of Bytes:

    The SearchResult contains the search for the same User.

    Is there any reason for this kind of behaviour?

    Thanks in advance.

    Best Regards,

    Rodrigo Guerreiro

    Friday, March 21, 2014 6:18 PM

Answers

  • Hi Rodrigo,

    I find an interesting explanation about the byte array. I recommend you have a look at it.

    Even though attributes are stored in a variety of types referred to as attribute syntax, S.DS.P always attempts to convert each value it retrieves into a string; otherwise it returns a byte array. Therefore, if you know the return type of a specific attribute value you want to return, use GetValues. If not, use the indexer and test the return type prior to displaying the values.

    You can find it at Returning Attribute Values section of the following link. http://msdn.microsoft.com/en-us/library/bb332056.aspx.

    Regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, March 25, 2014 6:16 AM
    Moderator

All replies

  • Hi Rodrigo,

    > Is there any reason for this kind of behaviour?

    Did you always run your code as administrator? I know it will return null if not run as administrator, so I think maybe you forget to use elevated privilege.

    Something about AD UserAccountControl:

    http://support.microsoft.com/kb/305144/en-us.

    http://www.codeproject.com/Articles/18102/Howto-Almost-Everything-In-Active-Directory-via-C.

    Regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, March 24, 2014 2:31 AM
    Moderator
  • Hi Herro,

    The code is always running with an admin account.

    However, as you can see on the screen it doesn't return a null object, it returns a array of bytes.

    Your codeproject link has some info about retriving userAccountControl data:

    //Add this to the create account method
    int val = (int)newUser.Properties["userAccountControl"].Value;

    So, i'm also expecting a integer type object.

    Best Regards,

    Rodrigo Guerreiro

    Monday, March 24, 2014 10:36 AM
  • Hi Rodrigo,

    I find an interesting explanation about the byte array. I recommend you have a look at it.

    Even though attributes are stored in a variety of types referred to as attribute syntax, S.DS.P always attempts to convert each value it retrieves into a string; otherwise it returns a byte array. Therefore, if you know the return type of a specific attribute value you want to return, use GetValues. If not, use the indexer and test the return type prior to displaying the values.

    You can find it at Returning Attribute Values section of the following link. http://msdn.microsoft.com/en-us/library/bb332056.aspx.

    Regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, March 25, 2014 6:16 AM
    Moderator