/// <summary> /// Change to new OU from current OU. /// </summary> /// <param name="orgnizationalUnit">The new OU.</param> public void ChangeOrganizationalUnit(OrganizationalUnitObject orgnizationalUnit) { this.DirectoryEntry.MoveTo(orgnizationalUnit.DirectoryEntry); orgnizationalUnit.DirectoryEntry.CommitChanges(); }
internal static ADObject GetADObject(IADOperator adOperator, SearchResult searchResult) { ADObject adObject; ADObjectType adObjectType = GetADObjectType(searchResult); switch (adObjectType) { case ADObjectType.User: adObject = new UserObject(adOperator, searchResult); break; case ADObjectType.Contact: adObject = new ContactObject(adOperator, searchResult); break; case ADObjectType.Computer: adObject = new ComputerObject(adOperator, searchResult); break; case ADObjectType.Container: adObject = new ContainerObject(adOperator, searchResult); break; case ADObjectType.Group: adObject = new GroupObject(adOperator, searchResult); break; case ADObjectType.InetOrgPerson: adObject = new InetOrgPersonObject(adOperator, searchResult); break; case ADObjectType.MSMQQueueAlias: adObject = new MSMQQueueAliasObject(adOperator, searchResult); break; case ADObjectType.MsImaging_PSPs: adObject = new MsImaging_PSPsObject(adOperator, searchResult); break; case ADObjectType.OrganizationalUnit: adObject = new OrganizationalUnitObject(adOperator, searchResult); break; case ADObjectType.Printer: adObject = new PrinterObject(adOperator, searchResult); break; case ADObjectType.SharedFolder: adObject = new SharedFolderObject(adOperator, searchResult); break; case ADObjectType.Domain: adObject = new DomainObject(adOperator, searchResult); break; case ADObjectType.PasswordSettings: adObject = new PasswordSettingsObject(adOperator, searchResult); break; default: adObject = new UnknownObject(adOperator, searchResult); break; } return(adObject); }