03-28-2012 09:22 AM
Dear all,
I am currently designing an application in LV7.1 which has to interface to a LDAP thanks to Active Directory services.
I have a problem with the data type Integer8 of Microsoft which is coded on 64 bits.
Such data type is often used in Active Directory to represent dates like for example the accountExpires property.
My problem appears when I try to read values of properties which are coded in Interger8: in order to marshal my .Net data I use the VI .NetObjectToVariant but this one returns me a refnum in the specific case of Integer8.
For example I get the following result:
.NET Refnum OMId Class Size: 98, Assembly Name: mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, Class Name: System.__ComObject 0x1A200006
How can I access to the corresponding value from this refnum?
Thanks in advance for your help.
Regards
03-28-2012 01:08 PM
You previously asked this question here: http://forums.ni.com/t5/LabVIEW/Net-probl%C3%A8me-avec-le-type-Integer8-64-Bits/m-p/1922037
I don't know French, so I don't know what worked/didn't work from the suggestions given. So, since you posted this in English here, what was the outcome of those suggestions? Are you closing the other thread? If so, indicate that in the other thread so we don't start talking in two different places.
03-29-2012 01:21 AM
Thank you for your answer.
Efficiently I have previously posted the same question in French but unfortunately no solution has been found. That's why I don't close the post and I try now in English to reach more people.
Until now I have tried to convert the output of .NetObjectToVariant.vi but it fails in the meaning that I always get a refnum that I can't interpret.
Any suggestions will be welcome.
Regards
03-29-2012 08:46 AM
The last property node you have here returns a collection, not an individual object. Thus, you'd need to use get_Item to get the one item in the collection (index = 0). You should be able to typecast this to an Int64, but when I tried I kept getting a .NET error. I found that using a Directory Searcher on your DirectoryEntry object will eventually get to the same information, and that final property value I was able to type cast to an Int64. Normally you could use DateTime.FromFileTime to get a timestamp that corresponds to this value, but LabVIEW 7.1 does not have any 64-bit integers. Thus, you're going to need to use the ToString() method on the Int64 object and parse it yourself.
03-29-2012 11:19 AM
Thank you for your answer and the screenshot.
I have tried to recreate your example but I don't find the .Net refnum constant System.Int64: which class have you selected?
For your information I use the System.DirectoryServices(2.0.0.0).
By the way, if we want to set the attribute do you think there is a chance to do this?
Regards.
03-29-2012 12:21 PM
You need to get System.Int64 from mscorlib.dll, which contains the core .NET classes. It's in the dropdown list.
As for setting it, I don't know if you can since I'm guessing you'd need to create a System.Int64. You could do this from the Int64.Parse() static method, using a string as the source of the value.
04-20-2012 02:44 AM
Sorry for the delay, but I have a lot of work to do...
Thank you for your answer,I think I will have time to try it in the next few days.
Regards