Exemple #1
0
        public static string GetName(this SearchResult source)
        {
            if (source == null)
            {
                throw new ArgumentNullException("source");
            }
            var split = source.Path.Split(_splitChars);

            return(Ldap.GetNameFromDN(split[split.Length - 1]));
        }
Exemple #2
0
 public static string MovePrincipal(this Func <string, DirectoryEntry> source, bool whatIf, string sourceDN, string targetDN)
 {
     if (source == null)
     {
         throw new ArgumentNullException("source");
     }
     if (string.IsNullOrEmpty(sourceDN))
     {
         throw new ArgumentNullException("sourceDN");
     }
     if (string.IsNullOrEmpty(targetDN))
     {
         throw new ArgumentNullException("targetDN");
     }
     Trace.TraceInformation("MovePrincipal: " + sourceDN + "->" + targetDN);
     if (whatIf)
     {
         return("R: " + sourceDN + "->" + targetDN + "\n");
     }
     using (var sourceDE = source(sourceDN))
         using (var targetDE = source(Ldap.GetContainerFromDN(targetDN)))
             sourceDE.MoveTo(targetDE, "CN=" + Ldap.GetNameFromDN(targetDN));
     return(null);
 }