예제 #1
0
        /// <summary>
        /// 重命名实体
        /// </summary>
        /// <param name="newName"></param>
        public void Rename(string newName)
        {
            string schema = DirectoryContext.GetEntitySchemaClassType(this.GetType());

            this.DirectoryEntry.Rename(schema + "=" + newName);
        }
예제 #2
0
 /// <summary>
 /// Get Active Directory Entities
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <param name="root">Root Entry</param>
 /// <param name="searchScope">Search Type</param>
 /// <returns></returns>
 static public List <T> GetEntities <T>(DirectoryEntry root, SearchScope searchScope) where T : IDirectoryEntity
 {
     using (DirectoryContext ctx = new DirectoryContext(root, searchScope)) {
         return(ctx.GetEntities <T>());
     }
 }