转:读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).
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).
相关文章推荐
- 使用Unity3d和C#的一些属性来设置特殊行为
- AD用户属性&C#操作实例
- 转:读AD里特殊的属性in C#
- c# [HideInInspector] 属性
- 【CLR in c#】属性
- 通过HttpHandler和属性用Javascript调用C#方法(Using a HttpHandler and Attributes to call C# methods in Javascript)
- 【C#】妈妈再也不用担心自定义控件如何给特殊类型的属性添加默认值了,附自定义GroupBox一枚
- Change expired password in AD with C# (使用c# 更改AD 中过期密码)
- c# ComboBox特殊属性
- AD用户属性&C#操作实例
- how to get domain user info from AD in C#
- Lua中访问C#中的属性和方法-特殊情况-带有out和ref关键字
- @符号是特殊而又实用的C#符号
- (原创)c#学习笔记10--定义类成员01--成员定义06--自动属性
- C#OOP基础之类,字段,属性和方法。
- C#反射读取和设置类的属性
- C#属性-索引器-里氏替换-多态-虚方法-抽象-接口-泛型-
- 【C# in depth 第三版】温故而知新(1) (转)
- Add Html/javascript Event In ASP.NET(C#)
- C#学习基本概念之自动实现的属性