域用户

http://www.cnblogs.com/zhongweiv/archive/2013/01/05/ad_sync.html#tab_a

这边文章有详细描述

DirectoryEntry entry = null;

entry = new DirectoryEntry(string.Format("LDAP://{0}",domain),CrmUserName,CrmPassword,AuthenticationTypes.Secure);

DirectorySearcher mySearcher = new DirectorySearcher(entry);
                        //mySearcher.Filter= ("(&(|(cn=" + searchUser + ")))");
                    mySearcher.Filter = ("(&(objectClass=user)(sAMAccountName="+searchUser+"))");
                    SearchResult searchResult = mySearcher.FindOne();
                    if (searchResult != null)
                    {
                        isExist = true;
                        Log.i("获取当前用户是域用户");
                        //_firstname = searchResult.Properties["sn"][0].ToString();
                        //_lastname = searchResult.Properties["givenname"][0].ToString();
                    }

阅读更多
想对作者说点什么?

博主推荐

换一批

没有更多推荐了,返回首页