public static string ConvertPath(ADSessionInfo sessionInfo, string path, ADPathFormat fromFormat, ADPathFormat toFormat) { string str; if (fromFormat != toFormat) { if (fromFormat == ADPathFormat.Canonical && !string.IsNullOrEmpty(path) && CanonicalPath.IndexOfFirstDelimiter(path) == -1) { path = string.Concat(path, "/"); } using (ADAccountManagement aDAccountManagement = new ADAccountManagement(sessionInfo)) { str = aDAccountManagement.TranslateName(path, fromFormat, toFormat); } return str; } else { return path; } }