Пример #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)));
        }
Пример #2
0
        protected override object InternalTryGetValue(PropertyBag.BasicPropertyStore propertyBag)
        {
            bool       flag             = false;
            ExDateTime?valueAsNullable  = propertyBag.GetValueAsNullable <ExDateTime>(InternalSchema.MapiStartTime);
            ExDateTime?valueAsNullable2 = propertyBag.GetValueAsNullable <ExDateTime>(InternalSchema.MapiEndTime);

            if (valueAsNullable != null && valueAsNullable2 != null && valueAsNullable2.Value - valueAsNullable.Value >= IsEventProperty.Hours24)
            {
                flag = true;
            }
            return(flag);
        }
Пример #3
0
        private bool?GetIsGroupMailboxFromDisplayTypeEx(PropertyBag.BasicPropertyStore propertyBag)
        {
            RecipientDisplayType?valueAsNullable = propertyBag.GetValueAsNullable <RecipientDisplayType>(InternalSchema.DisplayTypeExInternal);

            if (valueAsNullable == null)
            {
                return(null);
            }
            return(new bool?(DisplayTypeExProperty.IsGroupMailbox(valueAsNullable.Value)));
        }
        private bool?GetIsDLFromDisplayType(PropertyBag.BasicPropertyStore propertyBag)
        {
            LegacyRecipientDisplayType?valueAsNullable = propertyBag.GetValueAsNullable <LegacyRecipientDisplayType>(InternalSchema.DisplayType);

            if (valueAsNullable == null)
            {
                return(null);
            }
            return(new bool?(DisplayTypeExProperty.IsDL(valueAsNullable.Value)));
        }
Пример #5
0
        protected override object InternalTryGetValue(PropertyBag.BasicPropertyStore propertyBag)
        {
            Participant.Builder builder = new Participant.Builder();
            byte[] valueOrDefault       = propertyBag.GetValueOrDefault <byte[]>(InternalSchema.EntryId);
            if (valueOrDefault != null)
            {
                builder.SetPropertiesFrom(ParticipantEntryId.TryFromEntryId(valueOrDefault));
            }
            builder.DisplayName = (propertyBag.GetValueOrDefault <string>(InternalSchema.TransmitableDisplayName) ?? builder.DisplayName);
            if (!base.Get(propertyBag, builder))
            {
                return(new PropertyError(this, PropertyErrorCode.NotFound));
            }
            RecipientDisplayType?valueAsNullable = propertyBag.GetValueAsNullable <RecipientDisplayType>(InternalSchema.DisplayTypeExInternal);

            if (valueAsNullable != null)
            {
                builder[ParticipantSchema.DisplayTypeEx] = valueAsNullable.Value;
                builder.Origin = (builder.Origin ?? new DirectoryParticipantOrigin());
            }
            else if (PropertyError.IsPropertyNotFound(builder.TryGetProperty(ParticipantSchema.DisplayType)))
            {
                LegacyRecipientDisplayType?valueAsNullable2 = propertyBag.GetValueAsNullable <LegacyRecipientDisplayType>(InternalSchema.DisplayType);
                ObjectType?valueAsNullable3 = propertyBag.GetValueAsNullable <ObjectType>(InternalSchema.ObjectType);
                if (valueAsNullable2 != null)
                {
                    if (valueAsNullable2 != LegacyRecipientDisplayType.MailUser)
                    {
                        builder[ParticipantSchema.DisplayType] = (int)valueAsNullable2.Value;
                    }
                }
                else if (valueAsNullable3 != null && valueAsNullable3 == ObjectType.MAPI_DISTLIST)
                {
                    builder[ParticipantSchema.DisplayType] = 1;
                }
            }
            builder.SetOrDeleteProperty(ParticipantSchema.SendRichInfo, Util.NullIf <object>(propertyBag.GetValueAsNullable <bool>(InternalSchema.SendRichInfo), false));
            builder.SetOrDeleteProperty(ParticipantSchema.SendInternetEncoding, propertyBag.GetValueAsNullable <int>(InternalSchema.SendInternetEncoding));
            return(builder.ToParticipant());
        }
Пример #6
0
        protected override void InternalSetValue(PropertyBag.BasicPropertyStore propertyBag, object value)
        {
            AppointmentStateFlags?valueAsNullable       = propertyBag.GetValueAsNullable <AppointmentStateFlags>(InternalSchema.AppointmentStateInternal);
            AppointmentStateFlags appointmentStateFlags = (AppointmentStateFlags)value;

            if (valueAsNullable != null && (valueAsNullable.Value & AppointmentStateFlags.Received) == AppointmentStateFlags.Received && (appointmentStateFlags & AppointmentStateFlags.Received) != AppointmentStateFlags.Received)
            {
                propertyBag.SetLocationIdentifier(63651U, LastChangeAction.SmartPropertyFixup);
                ExTraceGlobals.StorageTracer.TraceInformation(63651, (long)propertyBag.GetHashCode(), "Prevent from removing Received flag on AppointmentState");
                appointmentStateFlags |= AppointmentStateFlags.Received;
            }
            propertyBag.SetValueWithFixup(InternalSchema.AppointmentStateInternal, appointmentStateFlags);
        }
Пример #7
0
 protected override object InternalTryGetValue(PropertyBag.BasicPropertyStore propertyBag)
 {
     Participant.Builder builder = new Participant.Builder();
     if (base.Get(propertyBag, builder))
     {
         bool?valueAsNullable = propertyBag.GetValueAsNullable <bool>(InternalSchema.SendRichInfo);
         if (valueAsNullable != null)
         {
             builder[ParticipantSchema.SendRichInfo] = valueAsNullable.Value;
         }
         return(builder.ToParticipant());
     }
     return(new PropertyError(this, PropertyErrorCode.NotFound));
 }
        protected override object InternalTryGetValue(PropertyBag.BasicPropertyStore propertyBag)
        {
            propertyBag.GetValueOrDefault <string>(InternalSchema.ItemClass);
            byte[] valueOrDefault = propertyBag.GetValueOrDefault <byte[]>(InternalSchema.ConversationIndex);
            if (valueOrDefault == null)
            {
                return(null);
            }
            ConversationIndex conversationIndex;

            if (!ConversationIndex.TryCreate(valueOrDefault, out conversationIndex))
            {
                return(null);
            }
            bool?valueAsNullable = propertyBag.GetValueAsNullable <bool>(InternalSchema.ConversationIndexTracking);

            if (valueAsNullable == null || !valueAsNullable.Value)
            {
                string topic = propertyBag.GetValueOrDefault <string>(InternalSchema.ConversationTopic) ?? string.Empty;
                byte[] bytes = this.ComputeHashTopic(topic);
                return(ConversationId.Create(bytes));
            }
            return(ConversationId.Create(conversationIndex.Guid));
        }