如何清除在Active Directory中的用户对象的属性? [英] How do I clear out a user object attribute in Active Directory?

查看:285
本文介绍了如何清除在Active Directory中的用户对象的属性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设你已经使用simiple语法连接到Active Directory:

Suppose you have connected to Active Directory using the simiple syntax:

string adPath = "LDAP://server.domain.com/CN=John,CN=Users,dc=domain,dc=com";
DirectoryEntry userEntry = Settings.GetADEntry(adPath);

现在你想看到该用户的属性,比如邮件属性:

Now you want to see an attribute for that user, say the mail attribute:

Console.WriteLine("User's mail attribute is " + userEntry.Properties["mail"]);

现在我怎么能删除邮件属性值?

Now how can I delete the mail attribute value?

推荐答案

这原来是pretty的简单,尽管不是很常用的...

It turns out to be pretty simple, albeit not very commonly used...

string adPath = "LDAP://server.domain.com/CN=John,CN=Users,dc=domain,dc=com";DirectoryEntry userEntry = Settings.GetADEntry(adPath);
userentry.Properties["mail"].Clear();
userentry.CommitChanges();

这篇关于如何清除在Active Directory中的用户对象的属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆