处理项目,其中所有用户都在域下的活动目录中创建。
我想要的是获取域中的所有用户,这可能吗?
我是活跃目录的新手,使用.net core2.0。
感谢任何建议和指导。
答案 0 :(得分:5)
.Net Foundation发布了针对.NET Core 2的System.DirectoryServices.AccountManagement
实现。请参阅nuget参考here
这将允许您拨打这样的电话:
using (var ctx = new PrincipalContext(ContextType.Domain, "MyDomain")){
var myDomainUsers = new List<string>();
var userPrinciple = new UserPrincipal(ctx);
using (var search = new PrincipalSearcher(userPrinciple)){
foreach (var domainUser in search.FindAll()){
if (domainUser.DisplayName != null){
myDomainUsers.Add(domainUser.DisplayName);
}
}
}
}
答案 1 :(得分:1)
确切地说我正在寻找... 您可以使用Microsoft Graph API与Microsoft云(包括AAD)中的数据用户进行交互。 链接在这里 Documentation