コード例 #1
0
        internal static ExDateTime?GetNormalizedTime(PropertyBag.BasicPropertyStore propertyBag, GuidIdPropertyDefinition utcTimeProperty, PropertyTagPropertyDefinition legacyUtcTimeProperty)
        {
            ExDateTime?valueAsNullable = propertyBag.GetValueAsNullable <ExDateTime>(utcTimeProperty);

            if (valueAsNullable == null)
            {
                if (legacyUtcTimeProperty != null)
                {
                    valueAsNullable = propertyBag.GetValueAsNullable <ExDateTime>(legacyUtcTimeProperty);
                }
                if (valueAsNullable == null)
                {
                    return(null);
                }
            }
            ExDateTime exDateTime = ExTimeZone.UtcTimeZone.ConvertDateTime(valueAsNullable.Value);

            byte[]     valueOrDefault = propertyBag.GetValueOrDefault <byte[]>(InternalSchema.TimeZoneDefinitionStart);
            ExTimeZone legacyTimeZone;

            if (O12TimeZoneFormatter.TryParseTimeZoneBlob(valueOrDefault, string.Empty, out legacyTimeZone))
            {
                exDateTime = TimeZoneHelper.NormalizeUtcTime(exDateTime, legacyTimeZone);
            }
            exDateTime = StartTimeProperty.DynamicAdjustForAllDayEvent(propertyBag, exDateTime, utcTimeProperty == InternalSchema.MapiEndTime);
            return(new ExDateTime?(propertyBag.TimeZone.ConvertDateTime(exDateTime)));
        }