Exemple #1
0
        protected Dictionary <string, string> ApplyAttachmentChanges(EntitySyncItem item)
        {
            Event @event = item.Item as Event;
            Dictionary <string, string> dictionary = null;

            if (@event.Attachments != null && @event.Attachments.Count > 0)
            {
                dictionary     = new Dictionary <string, string>(@event.Attachments.Count);
                @event.IsDraft = true;
                List <IAttachment> attachments = @event.Attachments;
                @event.Attachments = null;
                IAttachments attachments2 = this.Events[@event.Id].Attachments;
                foreach (IAttachment attachment in attachments)
                {
                    if (attachment is EntityDeleteAttachment)
                    {
                        attachments2.Delete(attachment.Id, null);
                    }
                    else
                    {
                        string id = attachment.Id;
                        attachment.Id = null;
                        string id2 = attachments2.Create(attachment, null).Id;
                        dictionary[id] = HttpUtility.UrlEncode(item.Item.Id + ":" + id2);
                    }
                }
                @event.IsDraft   = false;
                @event.ChangeKey = null;
            }
            return(dictionary);
        }