我有一个Domain User DirectoryEntry实例,但无法更新他的属性,如“公司”,“部门”,“经理”等。
以下是我的代码
public static void SetProperty(DirectoryEntry de,string PropertyName,string PropertyValue){ 如果(的PropertyValue!= NULL){ 如果(de.Properties.Contains(属性名)){ de.Properties将[PropertyName] [0] =的PropertyValue; } 其他{ de.Properties将[PropertyName]。新增(的PropertyValue); } } }
在de.commitchanges()之后,该属性无论如何都不会改变。并且没有错误/异常发生。请帮忙..谢谢。