Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
microsoft.public.dotnet.framework
SDS.AM Extensions
Bob Weiner
7/9/2008 9:22:00 PM
I like the new System.DirectoryServices.AccountManagement namespace. It
seems like it will make a lot of things easier to manage.
I am having trouble understanding how to extend and use the UserPrincipal to
get some things done. These include searching and updating the
proxyAddresses attribute for users. I tried to do this by Extending the
UserPrincipal as follows:
[DirectoryObjectClass("User")]
[DirectoryRdnPrefix("CN")]
public class Account : UserPrincipal {
// Constructor
public Account(PrincipalContext ou, string samAccountName, string password)
:
base(ou, samAccountName, password, true) { }
[DirectoryProperty("proxyAddresses")]
public string[] ProxyAddresses {
get {
int len = ExtensionGet("proxyAddresses").Length;
string[] addresses = new string[len];
object[] addressesRaw = ExtensionGet("proxyAddresses");
for (int i = 0; i < len; i++) {
addresses[i] = (string)addressesRaw[i];
}
return addresses;
}
set { ExtensionSet("proxyAddresses", value); }
}
I can use this to create a new account (User) in the AD but cannot use it to
retrieve the proxyAddresses. The various find methods only return
Principals or UserPrincipals and I cannot cast them to Account. I am using
http://msdn.microsoft.com/en-us/library/bb5...
as a model to work
from.
How can I access/update/search the proxyAddresses field for users?
Thanks, bob
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
SDS.AM Extensions
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password