以编程方式查询我公司的员工目录

发布于 2024-09-19 12:34:00 字数 345 浏览 4 评论 0原文

我的公司是一家微软商店(Exchange、AD等)。

我想对我们的员工目录进行查询,例如:

Person person = directory.Lookup("jsmith");
string title = person.Fields("JobTitle");
Person manager = person.GetManager();
if (person.IsManager())
{
    Person[] subordinates = person.GetSubordinates();
}

有没有简单的方法可以做这样的事情?我打算在脚本中非正式地完成此操作,而不是在运输代码中。

My company is a Microsoft shop (Exchange, AD, etc.).

I'd like to do queries on our employee directory like:

Person person = directory.Lookup("jsmith");
string title = person.Fields("JobTitle");
Person manager = person.GetManager();
if (person.IsManager())
{
    Person[] subordinates = person.GetSubordinates();
}

Is there any easy way to do something like this? I intend to do it on an informal basis in scripts, not in shipping code.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

小霸王臭丫头 2024-09-26 12:34:00

我从未使用过这个,但它看起来很有趣:

Linq to Active Directory

举个例子:

var users = new DirectorySource<User>(ROOT, SearchScope.Subtree);
users.Log = Console.Out;

var res = from usr in users
          where usr.FirstName.StartsWith("B") && usr.Office == "2525"
          select new { Name = usr.FirstName + " " + usr.LastName, usr.Office, usr.LogonCount };

foreach (var u in res)
{
    Console.WriteLine(u);
    u.Office = "5252";
    u.SetPassword(pwd);
}

users.Update();

I've never used this but it looks interesting:

Linq to Active Directory

The give an example:

var users = new DirectorySource<User>(ROOT, SearchScope.Subtree);
users.Log = Console.Out;

var res = from usr in users
          where usr.FirstName.StartsWith("B") && usr.Office == "2525"
          select new { Name = usr.FirstName + " " + usr.LastName, usr.Office, usr.LogonCount };

foreach (var u in res)
{
    Console.WriteLine(u);
    u.Office = "5252";
    u.SetPassword(pwd);
}

users.Update();
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文