/// <summary> /// Enumerates certificate templates registered in Active Directory. /// </summary> /// <returns>An array of certificate templates.</returns> public static CertificateTemplate[] EnumTemplates() { if (DsUtils.Ping()) { String cn = _baseDsPath; DirectoryEntries entries = DsUtils.GetChildItems(cn); return((from DirectoryEntry item in entries select new CertificateTemplate("name", (String)item.Properties["cn"].Value)).ToArray()); } throw new Exception(Error.E_DCUNAVAILABLE); }
/// <summary> /// Enumerates certificate templates registered in Active Directory. /// </summary> /// <returns>An array of certificate templates.</returns> public static CertificateTemplate[] EnumTemplates() { if (!DsUtils.Ping()) { throw new Exception(Error.E_DCUNAVAILABLE); } var retValue = new List <CertificateTemplate>(); foreach (DirectoryEntry dsEntry in DsUtils.GetChildItems(_baseDsPath)) { using (dsEntry) { retValue.Add(FromCommonName(dsEntry.Properties["cn"].Value.ToString())); } } return(retValue.ToArray()); }