Exemple #1
0
        public override OperationResult DeleteSyncItem(SyncCommandItem syncCommandItem, bool deletesAsMoves)
        {
            AirSyncDiagnostics.TraceInfo(ExTraceGlobals.RequestsTracer, this, "SyncCollection.DeleteSyncItem(SyncCommandItem)");
            EntitySyncProviderFactory entitySyncProviderFactory = (EntitySyncProviderFactory)base.SyncProviderFactory;
            StoreObjectId             folderId = entitySyncProviderFactory.FolderId;

            if (AirSyncUtility.GetAirSyncFolderTypeClass(folderId) == "Calendar")
            {
                CancelEventParameters parameters;
                if (syncCommandItem.XmlNode != null)
                {
                    try
                    {
                        parameters = EventParametersParser.ParseCancel(syncCommandItem.XmlNode);
                        goto IL_72;
                    }
                    catch (RequestParsingException ex)
                    {
                        throw new AirSyncPermanentException(StatusCode.Sync_ProtocolError, ex.LocalizedString, ex, false)
                              {
                                  ErrorStringForProtocolLogger = ex.LogMessage
                              };
                    }
                }
                parameters = new CancelEventParameters();
IL_72:
                this.DeleteItem(syncCommandItem.Id, parameters);
                return(OperationResult.Succeeded);
            }
            return(this.DeleteSyncItem(syncCommandItem.ServerId, deletesAsMoves));
        }
        // Token: 0x0600172D RID: 5933 RVA: 0x0008A7AC File Offset: 0x000889AC
        public void UpdateId(EntitySyncProviderFactory factory, string itemId)
        {
            base.CheckDisposed("get_NativeItem");
            if (base.NativeItem != null)
            {
                throw new InvalidOperationException("The sync item already has NativeItem");
            }
            StoreObjectId storeId = StoreId.EwsIdToFolderStoreObjectId(itemId);

            base.NativeItem = Microsoft.Exchange.Data.Storage.Item.Bind(factory.StoreSession, storeId, EntitySyncItem.WatermarkProperties);
            this.Item       = null;
        }
Exemple #3
0
        protected ISyncItemId ApplyChanges(SyncCommandItem syncCommandItem)
        {
            AirSyncDiagnostics.TraceInfo(ExTraceGlobals.RequestsTracer, this, "SyncCollection.ApplyChanges");
            EntitySyncItem            entitySyncItem = (EntitySyncItem)syncCommandItem.Item;
            EntitySyncProviderFactory factory        = (EntitySyncProviderFactory)base.SyncProviderFactory;
            Event @event = entitySyncItem.Item as Event;

            try
            {
                if (@event == null)
                {
                    throw new NotImplementedException(string.Format("SyncCollection.ApplyChanges item type {0} is not supported", entitySyncItem.GetType().FullName));
                }
                switch (syncCommandItem.ChangeType)
                {
                case ChangeType.Add:
                {
                    List <IAttachment> list = null;
                    if (@event.Attachments != null && @event.Attachments.Count > 0)
                    {
                        list = @event.Attachments;
                        @event.Attachments = null;
                        @event.IsDraft     = true;
                    }
                    @event = this.Events.Create(@event, null);
                    entitySyncItem.UpdateId(factory, @event.Id);
                    base.ItemIdMapping.Add(entitySyncItem.Id);
                    syncCommandItem.UID = @event.Id;
                    if (list == null)
                    {
                        goto IL_16A;
                    }
                    @event = new Event
                    {
                        Id          = @event.Id,
                        Attachments = list
                    };
                    entitySyncItem = EntitySyncItem.Bind(@event);
                    break;
                }

                case ChangeType.Change:
                    break;

                case (ChangeType)3:
                    goto IL_134;

                case ChangeType.Delete:
                    throw new InvalidOperationException("SyncCollection.ApplyChanges does not support Delete, use DeleteItem.");

                default:
                    goto IL_134;
                }
                syncCommandItem.AddedAttachments = this.ApplyAttachmentChanges(entitySyncItem);
                @event.Id = this.Events.Update(@event, null).Id;
                ((EntitySyncItem)syncCommandItem.Item).Reload();
                goto IL_16A;
IL_134:
                throw new NotImplementedException(string.Format("SyncCollection.ApplyChanges ChangeType {0} is not supported", syncCommandItem.ChangeType));
                IL_16A :;
            }
            finally
            {
                if (!object.ReferenceEquals(entitySyncItem, (EntitySyncItem)syncCommandItem.Item))
                {
                    entitySyncItem.Dispose();
                }
            }
            return(syncCommandItem.Item.Id);
        }