Windows Server 2008 R2のACTIVE DIRECTORYで ユーザーを追加して変更できるソフトウェアをプログラミングしています。
使った
using System.DirectoryServices.AccountManagement;
[DirectoryRdnPrefix("CN")]
[DirectoryObjectClass("Person")]
public class UserPrincipalEx : UserPrincipal
{
// Implement the constructor using the base class constructor.
public UserPrincipalEx(PrincipalContext context)
: base(context)
{ }
// Implement the constructor with initialization parameters.
public UserPrincipalEx(PrincipalContext context,
string samAccountName,
string password,
bool enabled)
: base(context, samAccountName, password, enabled)
{ }
// Create the "TermSrvProfilePath" property.
[DirectoryProperty("msTSProfilePath")]
public string TermSrvProfilePath
{
get
{
if (ExtensionGet("msTSProfilePath").Length != 1)
return "vide";
return (string)ExtensionGet("msTSProfilePath")[0];
}
set { ExtensionSet("msTSProfilePath", value); }
}
public static new UserPrincipalEx FindByIdentity(PrincipalContext context,
string identityValue)
{
return (UserPrincipalEx)FindByIdentityWithType(context,
typeof(UserPrincipalEx),
identityValue);
}
[DirectoryProperty("wWWHomePage")]
public string wWWHomePage
{
get
{
if (ExtensionGet("wWWHomePage").Length != 1)
return null;
return (string)ExtensionGet("wWWHomePage")[0];
}
set { this.ExtensionSet("wWWHomePage", value); }
}
}
それで、結果はどうですか?
wWWHomePage属性を正常に読み取りましたが、取得しようとすると空です: TermSrvProfilePath ....
私は理解していません、私は完全に迷っています!