文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
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;
            }
        }

相关阅读 更多 +
排行榜 更多 +
辰域智控app

辰域智控app

系统工具 下载
网医联盟app

网医联盟app

运动健身 下载
汇丰汇选App

汇丰汇选App

金融理财 下载