文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>Indicate whether the user exist in AD

Indicate whether the user exist in AD

时间:2011-03-08  来源:流流

 static bool IsExistInAD(UserInfo user)
        {
            DirectorySearcher search = new DirectorySearcher();
            search.Filter = String.Format("(SAMAccountName={0})", user.SAPID);
            SearchResult result = search.FindOne();

            if (result == null)
            {
                return false;
            }
            else
            {
                DirectoryEntry entry = result.GetDirectoryEntry();
                //foreach (var temp in entry.Properties.PropertyNames)
                //{
                //    Console.Write("" + temp.ToString() + ": " + entry.Properties[temp.ToString()][0] + Environment.NewLine);
                //}
                (entry.Properties["title"]).Value = user.Title;
                (entry.Properties["company"]).Value = "Company";
                (entry.Properties["telephoneNumber"]).Value ="+86 (21) "+ user.Tele;
                (entry.Properties["mobile"]).Value = "+86 "+user.Mobile;
                (entry.Properties["streetAddress"]).Value = "........";
                (entry.Properties["postalCode"]).Value = "222221";
               
                entry.CommitChanges();
                Console.WriteLine(user.SAPID);
                return true;
            }
        }

相关阅读 更多 +
排行榜 更多 +
《上古卷轴5:天际重制版》冒险家混搭黑色重新着色MOD

《上古卷轴5:天际重制版》冒险家混搭黑色重新着色MOD

行业软件 下载
一个人的战意无限金币

一个人的战意无限金币

休闲益智 下载
迷你建造王2正版

迷你建造王2正版

休闲益智 下载