public static bool IsPortalObjectInvalid(dynamic content, ADSearchResult result, bool novellSupport) { // should the portal object be synchronized? // note: this is only to decide whether the properties/name of the object has changed // moving of objects is carried out independently // NOVELL - objects are always synced, as there is no such property named "whenchanged" if (novellSupport) { return(true); } var lastSyncDate = (DateTime)content.LastSync; lastSyncDate = TimeZoneInfo.ConvertTime(lastSyncDate, TimeZoneInfo.Utc); var contentModificationDate = (DateTime)content.ModificationDate; contentModificationDate = TimeZoneInfo.ConvertTime(contentModificationDate, TimeZoneInfo.Utc); // When comparing content modification date to last sync date, we have to add a small delta, // because modification date will always be a few ticks bigger than last sync date. return(result.WhenChanged > lastSyncDate || contentModificationDate > lastSyncDate.AddSeconds(10)); }
public static string GetParentPath(this ADSearchResult sr) { return(sr.Path.Substring(sr.Path.IndexOf(",", StringComparison.Ordinal) + 1)); }