Exemple #1
0
        internal static CalendarMethod GetICalMethod(Item item)
        {
            CalendarMethod result    = CalendarMethod.None;
            string         className = item.ClassName;

            if (ObjectClass.IsMeetingRequest(className))
            {
                result = CalendarMethod.Request;
            }
            else if (ObjectClass.IsMeetingCancellation(className))
            {
                result = CalendarMethod.Cancel;
            }
            else if (ObjectClass.IsMeetingResponse(className))
            {
                if (item.GetValueOrDefault <bool>(InternalSchema.AppointmentCounterProposal))
                {
                    result = CalendarMethod.Counter;
                }
                else
                {
                    result = CalendarMethod.Reply;
                }
            }
            else if (ObjectClass.IsCalendarItemCalendarItemOccurrenceOrRecurrenceException(className))
            {
                result = CalendarMethod.Publish;
            }
            return(result);
        }
Exemple #2
0
        protected override object InternalTryGetValue(PropertyBag.BasicPropertyStore propertyBag)
        {
            string valueOrDefault = propertyBag.GetValueOrDefault <string>(InternalSchema.ItemClass);

            if (valueOrDefault == null)
            {
                return(RecurrenceType.None);
            }
            if (ObjectClass.IsTask(valueOrDefault) || ObjectClass.IsTaskRequest(valueOrDefault))
            {
                if (propertyBag.GetValueOrDefault <bool>(InternalSchema.IsOneOff))
                {
                    return(RecurrenceType.None);
                }
                byte[] valueOrDefault2 = propertyBag.GetValueOrDefault <byte[]>(InternalSchema.TaskRecurrence);
                return(RecurrenceTypeProperty.GetTaskRecurrenceTypeFromBlob(valueOrDefault2));
            }
            else
            {
                if (ObjectClass.IsCalendarItemCalendarItemOccurrenceOrRecurrenceException(valueOrDefault) || ObjectClass.IsMeetingMessage(valueOrDefault))
                {
                    return(propertyBag.GetValueOrDefault <RecurrenceType>(InternalSchema.MapiRecurrenceType));
                }
                return(RecurrenceType.None);
            }
        }
 internal static bool GetForCalendarItem(string messageClass, AppointmentStateFlags flags)
 {
     if (!ObjectClass.IsCalendarItemCalendarItemOccurrenceOrRecurrenceException(messageClass) && !ObjectClass.IsCalendarItemSeries(messageClass))
     {
         throw new ArgumentException(string.Format("[IsOrganizerProperty.GetForCalendarItem] Message class MUST be a calendar item occurrence or recurrence exception in order to call this method.  ItemClass: {0}", messageClass));
     }
     return((flags & AppointmentStateFlags.Received) == AppointmentStateFlags.None);
 }
        protected override object InternalTryGetValue(PropertyBag.BasicPropertyStore propertyBag)
        {
            bool?  flag           = null;
            string valueOrDefault = propertyBag.GetValueOrDefault <string>(InternalSchema.ItemClass, string.Empty);

            if (ObjectClass.IsCalendarItemCalendarItemOccurrenceOrRecurrenceException(valueOrDefault) || ObjectClass.IsCalendarItemSeries(valueOrDefault))
            {
                AppointmentStateFlags valueOrDefault2 = propertyBag.GetValueOrDefault <AppointmentStateFlags>(InternalSchema.AppointmentStateInternal);
                flag = new bool?(IsOrganizerProperty.GetForCalendarItem(valueOrDefault, valueOrDefault2));
            }
            else if (ObjectClass.IsMeetingMessage(valueOrDefault))
            {
                MeetingMessage meetingMessage = propertyBag.Context.StoreObject as MeetingMessage;
                if (meetingMessage != null)
                {
                    CalendarItemBase calendarItemBase = null;
                    try
                    {
                        calendarItemBase = meetingMessage.GetCorrelatedItemInternal(true);
                    }
                    catch (CorruptDataException)
                    {
                    }
                    catch (CorrelationFailedException)
                    {
                    }
                    if (calendarItemBase != null)
                    {
                        flag = new bool?(calendarItemBase.IsOrganizer());
                    }
                    else if (!(meetingMessage is MeetingResponse))
                    {
                        flag = new bool?(meetingMessage.IsMailboxOwnerTheSender());
                    }
                }
            }
            if (flag != null)
            {
                return(flag);
            }
            return(new PropertyError(this, PropertyErrorCode.NotFound));
        }
Exemple #5
0
        private ConflictResolutionResult ApplyAcr(PropertyBag acrPropBag, SaveMode saveMode)
        {
            Dictionary <PropertyDefinition, AcrPropertyProfile.ValuesToResolve> valuesToResolve = this.GetValuesToResolve(acrPropBag);
            string valueOrDefault = this.PropertyBag.GetValueOrDefault <string>(InternalSchema.ItemClass, string.Empty);

            if (ObjectClass.IsCalendarItemCalendarItemOccurrenceOrRecurrenceException(valueOrDefault) || ObjectClass.IsMeetingMessage(valueOrDefault))
            {
                LocationIdentifierHelper           locationIdentifierHelper = new LocationIdentifierHelper();
                AcrPropertyProfile.ValuesToResolve valuesToResolve2;
                object serverValue;
                if (valuesToResolve.TryGetValue(InternalSchema.ChangeList, out valuesToResolve2))
                {
                    locationIdentifierHelper.ChangeBuffer = (byte[])valuesToResolve2.ClientValue;
                    serverValue = valuesToResolve2.ServerValue;
                }
                else
                {
                    serverValue = new PropertyError(InternalSchema.ChangeList, PropertyErrorCode.NotFound);
                }
                locationIdentifierHelper.SetLocationIdentifier(53909U, LastChangeAction.AcrPerformed);
                valuesToResolve2 = new AcrPropertyProfile.ValuesToResolve(locationIdentifierHelper.ChangeBuffer, serverValue, null);
                valuesToResolve[InternalSchema.ChangeList] = valuesToResolve2;
            }
            ConflictResolutionResult conflictResolutionResult = this.profile.ResolveConflicts(valuesToResolve);

            if (this.propertiesWrittenAsStream.Count > 0)
            {
                List <PropertyConflict> list = new List <PropertyConflict>(conflictResolutionResult.PropertyConflicts);
                foreach (PropertyDefinition propertyDefinition in this.propertiesWrittenAsStream.Keys)
                {
                    PropertyConflict item = new PropertyConflict(propertyDefinition, null, null, null, null, false);
                    list.Add(item);
                }
                conflictResolutionResult = new ConflictResolutionResult(SaveResult.IrresolvableConflict, list.ToArray());
            }
            if (this.irresolvableChanges || saveMode == SaveMode.FailOnAnyConflict)
            {
                conflictResolutionResult = new ConflictResolutionResult(SaveResult.IrresolvableConflict, conflictResolutionResult.PropertyConflicts);
            }
            if (conflictResolutionResult.SaveStatus != SaveResult.IrresolvableConflict)
            {
                List <PropertyDefinition> list2 = new List <PropertyDefinition>();
                List <PropertyDefinition> list3 = new List <PropertyDefinition>();
                List <object>             list4 = new List <object>();
                if (this.propertyBag == acrPropBag)
                {
                    foreach (PropertyConflict propertyConflict in conflictResolutionResult.PropertyConflicts)
                    {
                        if (propertyConflict.ResolvedValue is PropertyError)
                        {
                            if (PropertyError.IsPropertyNotFound(propertyConflict.ResolvedValue) && (!PropertyError.IsPropertyError(propertyConflict.ClientValue) || !PropertyError.IsPropertyNotFound(propertyConflict.ClientValue)))
                            {
                                list2.Add(propertyConflict.PropertyDefinition);
                            }
                        }
                        else if (propertyConflict.ResolvedValue != propertyConflict.ClientValue)
                        {
                            list3.Add(propertyConflict.PropertyDefinition);
                            list4.Add(propertyConflict.ResolvedValue);
                        }
                    }
                }
                else
                {
                    foreach (PropertyConflict propertyConflict2 in conflictResolutionResult.PropertyConflicts)
                    {
                        if (propertyConflict2.ResolvedValue is PropertyError)
                        {
                            if (PropertyError.IsPropertyNotFound(propertyConflict2.ResolvedValue))
                            {
                                list2.Add(propertyConflict2.PropertyDefinition);
                            }
                        }
                        else if (propertyConflict2.ServerValue != propertyConflict2.ResolvedValue)
                        {
                            list3.Add(propertyConflict2.PropertyDefinition);
                            list4.Add(propertyConflict2.ResolvedValue);
                        }
                    }
                }
                for (int k = 0; k < list2.Count; k++)
                {
                    acrPropBag.Delete(list2[k]);
                }
                for (int l = 0; l < list3.Count; l++)
                {
                    acrPropBag[list3[l]] = list4[l];
                }
            }
            return(conflictResolutionResult);
        }