コード例 #1
0
        /// <summary>
        /// True if the override window is open for this item.
        /// </summary>
        /// <remarks>In order to allow manual sync, we need to be able to override the disablement of syncing -
        /// but only briefly.</remarks>
        /// <param name="olItem">The item which we wish to sync.</param>
        /// <returns>True if the manual sync window is open for this item.</returns>
        public static bool IsManualOverride(this Outlook.ContactItem olItem)
        {
            bool result = false;

            if (olItem.UserProperties[OverridePropertyName] != null)
            {
                DateTime value = olItem.UserProperties[OverridePropertyName].Value;

                if ((DateTime.UtcNow - value).Minutes < OverrideWindowMinutes)
                {
                    result = true;
                }
                else
                {
                    /* no point holding on to a timed-out manual override property */
                    olItem.ClearManualOverride();
                }
            }

            return(result);
        }