473,407 Members | 2,314 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

AccountExpires WITHOUT ACTIVEDS

In c#,

How can I get the "accountExpires" without having to register the ACTIVEDS
COM object on the client?

DirectoryEntry returns almost all value with the COM object except for dates.

Why MS designed .NET object returning COM object? I hoped we got rid of the
complexity of COM in .NET

Now it seems I have to make install program for .NET program to installed
COM DLL only because .NET object are returning COM object.

Oct 30 '06 #1
1 5961

"SHEBERT" <SH*****@discussions.microsoft.comwrote in message
news:43**********************************@microsof t.com...
| In c#,
|
| How can I get the "accountExpires" without having to register the ACTIVEDS
| COM object on the client?
|
You don't have to register activeds on the client, activeds is part of the
system install.

| DirectoryEntry returns almost all value with the COM object except for
dates.
|
| Why MS designed .NET object returning COM object? I hoped we got rid of
the
| complexity of COM in .NET
|
Because the functionality was there and stable?

| Now it seems I have to make install program for .NET program to installed
| COM DLL only because .NET object are returning COM object.
Again, you don't have to install anything COM, activeds.tlb and activeds.dll
are already installed.
You can "late bind" to the underlying activeds.dll by using reflection, or
if that's also too complicated, you can use vb.net which supports this
out-of-the-box.
But I guess you are talking about the interop assembly, you can get rid of
it by using reflection to invoke members on the COM interface, or you can
use vb.net which supports late binding at the language level.

// say user is a DirectoryEntry representing a AD user object.
long expDate =
LongFromLargeInteger(user.Properties["accountExpires"].Value);
//Now, convert the long returned to dateTime, but beware that -1 is returned
for "account never expires", which is an invalid data!
....

private static long LongFromLargeInteger( object largeInteger )
{
System.Type type = largeInteger.GetType();
int highPart =
(int)type.InvokeMember("HighPart",BindingFlags.Get Property,
null, largeInteger, null);
int lowPart = (int)type.InvokeMember("LowPart",BindingFlags.GetP roperty,
null, largeInteger, null);
return (long)highPart << 32 | (uint)lowPart;
}

Willy.
Oct 30 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
by: D. Alvarado | last post by:
Hello, I am trying to open a window containing an image and I would like the image to be flush against the window -- i.e. have no padding or border. Can I make this happen with a single call to a...
9
by: WalterR | last post by:
This is my first time here, so there may be earlier relevant threads of which I am unaware. Though my experience with DB2 is not extensive, such as it is was under OS/390 or equ. My main...
2
by: Ram | last post by:
Hey, I'v managed to find a way of adding NTFS permissions to a certain folder, But the problem is, the folder has a couple of inherited permissions which I want to delete. How can I remove the...
7
by: Ralf Gedrat | last post by:
Hello! I have some Vb.Net applications, which are terminated at indefinite times without message. If I call in the program regulated system.GC.Collect, then the program is terminated here...
0
by: James | last post by:
Hi all. Would I be correct in saying that a dotnet application can use System.DirectoryServices to achieve anything that use of ActiveDs (Active DS Type Library) gives me? I originally wanted...
0
by: Pucca | last post by:
It was working before but now I'm getting the following compiling error. How can I correct this? //at my using 'ActiveDs' statement. Error 3 The type or namespace name 'ActiveDs' could not be...
0
by: Ian Toltz | last post by:
Is anyone using System.DirectoryServices successfully in an application on Vista? Using this amazing article ( http://www.codeproject.com/useritems/everythingInAD.asp ) I've been working on...
5
by: mmcd79 | last post by:
I built a VB.net application that makes use of a machine level DB connection string setting, and a user level starting location setting. The machine level setting and the default user based...
0
by: Ronald Hermans | last post by:
Hello, I wrote a program to add en mutate users in the active directory. Everything is working fine on my development machine, even connected to the actual server. But, when I put the...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.