public ModifiedAppointmentInstance GetModifiedInstance(int attachmentIndex)
        {
            AttachmentObject attachmentObject = this.GetAttachmentObject(attachmentIndex);
            Subnode          subnode          = attachmentObject.AttachedNode;

            if (subnode != null)
            {
                ModifiedAppointmentInstance modifiedInstance = new ModifiedAppointmentInstance(subnode);
                return(modifiedInstance);
            }
            return(null);
        }
Ejemplo n.º 2
0
        public void StoreModifiedInstance(ModifiedAppointmentInstance modifiedInstance, TimeZoneInfo timezone)
        {
            PC.SetDateTimeProperty(PropertyID.PidTagExceptionReplaceTime, modifiedInstance.StartDTUtc);
            PC.SetDateTimeProperty(PropertyID.PidTagExceptionStartTime, modifiedInstance.GetStartDTZone(timezone));
            PC.SetDateTimeProperty(PropertyID.PidTagExceptionEndTime, modifiedInstance.GetEndDTZone(timezone));
            int dataSize;

            if (this.File.WriterCompatibilityMode < WriterCompatibilityMode.Outlook2007SP2)
            {
                dataSize = modifiedInstance.PC.GetTotalLengthOfAllProperties();
            }
            else
            {
                dataSize = modifiedInstance.DataTree.TotalDataLength;
            }
            // The length must include the message size as well, so we add it as placeholder
            PC.SetInt32Property(PropertyID.PidTagAttachSize, 0);
            int attachmentSize = this.PC.GetTotalLengthOfAllProperties() + dataSize;

            PC.SetObjectProperty(PropertyID.PidTagAttachData, modifiedInstance.SubnodeID, dataSize);
            PC.SetInt32Property(PropertyID.PidTagAttachSize, attachmentSize);
        }
        public void AddModifiedInstanceAttachment(DateTime originalStartDTUtc, int originalDuration, DateTime newStartDTUtc, int duration, string subject, string location, BusyStatus busyStatus, int color, MessagePriority priority, TimeZoneInfo timezone)
        {
            AttachmentObject            attachment       = AttachmentObject.CreateNewExceptionAttachmentObject(this.File, this.SubnodeBTree);
            ModifiedAppointmentInstance modifiedInstance = ModifiedAppointmentInstance.CreateNewModifiedInstance(attachment.File, attachment.SubnodeBTree);

            modifiedInstance.SetStartAndDuration(newStartDTUtc, duration);
            modifiedInstance.AlternateRecipientAllowed = true;
            modifiedInstance.Subject  = subject;
            modifiedInstance.Location = location;
            //modifiedInstance.Sensitivity = 0;
            modifiedInstance.Priority             = priority;
            modifiedInstance.BusyStatus           = busyStatus;
            modifiedInstance.Color                = color;
            modifiedInstance.MessageFlags         = MessageFlags.MSGFLAG_READ;
            modifiedInstance.ExceptionReplaceTime = originalStartDTUtc;
            modifiedInstance.StartDate            = originalStartDTUtc;
            modifiedInstance.EndDate              = originalStartDTUtc.AddMinutes(originalDuration);

            modifiedInstance.SaveChanges(attachment.SubnodeBTree);
            attachment.StoreModifiedInstance(modifiedInstance, timezone);
            attachment.SaveChanges(this.SubnodeBTree);
            this.AddAttachment(attachment);
        }