One thing that I'll point out is that I rely on ActiveDS more than DirectoryEntry....so for those against this, I am sorry :)
I'd like to start off with the AdUser class that I use from my AdLibrary which you can download from here:
using System;To be honest, not much can be done with this. However, combined with all the other classes in the upcoming posts you will see how it all ties together.
using System.Collections.Generic;
using System.Text;
using ActiveDs;
using System.DirectoryServices;
namespace AdLib
{
public class AdUser : IDisposable
{
private DirectoryEntry _entry;
private IADsUser _user;
public AdUser(DirectoryEntry entry)
{
if (entry == null)
throw new ArgumentNullException("entry");
_entry = entry;
_user = (IADsUser)entry.NativeObject;
}
public DirectoryEntry Entry
{
get { return _entry; }
}
public IADsUser NativeObject
{
get { return _user; }
}
#region IDisposable Members
public void Dispose()
{
_entry.Dispose();
}
void IDisposable.Dispose()
{
Dispose();
}
#endregion
}
}
No comments:
Post a Comment