Get binary file from AD

Get binary file from AD


I have an application that retrieves the user photo from AD. For this I was using the Property_GetBinValues action from Enterprise Manager's LDAP extension. Now I am upgrading the environment 9.0. Due to platform 9.0 breaking changes, extensions with no source code will not be upgraded...
I tried to use LDAP_PropertyGetList from System Components' Authentication extension (since there is no equivalent to GetBinValues). The problem is that the output from LDAP_PropertyGetList is text, so I tried to use TextToBinaryData to convert the output into a file but is not working...

If I try to open the file windows says it is corrupted. When I opened the file in Notepad++, the content is System.Byte[].

When I am debugging, the output from LDAP_PropertyGetList.Properties.Current.Property.Value is System.Byte[].

Is there any workaround to this or is there any plans to include the old Property_GetBinValues into the Authentication extension?

Thanks in advance,
Hi José,

Did you try the TextToBinaryData action from the BinaryData extension? If that doesn't work, you can always opt to write an extension to convert between the two.
Hi Killian,

Yes, I tried the TextToBinaryData to convert the output.
I think the problem is with the output from LDAP_PropertyGetList.Properties.Current.Property.Value that is returning System.Byte[].
When I try to open the converted file, I can't as windows says that the file is corrupted. When I open the file with notepadd++, it does not look like a binary file, as the content is only "System.Byte[]", which is the output from LDAP_PropertyGetList.Properties.Current.Property.Value I get when I am debugging...

I think LDAP_PropertyGetList is converting the output into text and thus, I cant convert it back to binary data. As the output is "System.Byte[]" and not a valid base64 text, I can't use that conversion either...

I hope that I am explaining my problem clearly enough....

Ho José,

So the "Value" is actually a string literal that says "System.Byte[]"? In that case, you're royally screwed :(.