您的位置:首页 > 编程语言 > C#

转:读AD里特殊的属性in C#

2005-04-27 14:57 375 查看
摘自from:http://www.cnblogs.com/flier/archive/2004/10/21/55266.html?Pending=true#Post

AD里的一些属性:"accountExpires", "pwdLastSet" 等,在ADSIEDIT.msc中查看类型为LargerInteger,但不能通过DirectoryEntry属性直接读出,读他人一篇blog得到解决方法。添加com引用using ActiveDs;使用ActiveDs里的类型,强制转化属性的value为IADsLargeInteger类型,在调用GetLongValue方法转为long型,下面代码拷贝自引用blog。

public class AdUser : AdItem

 

internal long GetLongValue(IADsLargeInteger value)

用户是否可以远程登录属性的读取方法:

引用名称空间:using TSUSEREXLib;

先将DirectoryEntry 变成基本的adsi类型,然后再定义为IADsTSUserEx类型,在调用里面的方法。

object objAD = userDEntry.NativeObject ;

   int k = ((IADsTSUserEx)objAD).AllowLogon;

//Value that specifies whether to allow remote observation or remote control of the user's

   //Terminal Services session. Values include: "Disable" (0), "EnableInputNotify" (1),

   //"EnableInputNoNotify" (2), "EnableNoInputNotify" (3), and "EnableNoInputNoNotify" (4).
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: