public void AddAttachment(PSTFile file, AttachmentObject attachment)
        {
            AddAttachmentTableColumns(file);
            int rowIndex = AddRow(attachment.SubnodeID.Value);

            UpdateAttachment(file, attachment, rowIndex);
        }
        private void UpdateAttachment(PSTFile file, AttachmentObject attachment, int rowIndex)
        {
            TableContextHelper.CopyProperties(attachment.PC, this, rowIndex);

            this.SetInt32Property(rowIndex, PropertyID.PidTagLtpRowId, (int)attachment.SubnodeID.Value);
            // UNDOCUMENTED - Outlook uses dwUnique for PidTagLtpRowVer
            this.SetInt32Property(rowIndex, PropertyID.PidTagLtpRowVer, (int)file.Header.AllocateNextUniqueID());
        }
        private void UpdateAttachment(PSTFile file, AttachmentObject attachment)
        {
            int rowIndex = GetRowIndex(attachment.SubnodeID.Value);

            if (rowIndex >= 0)
            {
                UpdateAttachment(file, attachment, rowIndex);
            }
        }
        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);
        }
        public void AddAttachment(AttachmentObject attachment)
        {
            CreateAttachmentTableIfNotExist();
            MessageFlags flags = this.MessageFlags;

            if ((flags & MessageFlags.MSGFLAG_HASATTACH) == 0)
            {
                flags            |= MessageFlags.MSGFLAG_HASATTACH;
                this.MessageFlags = flags;
            }

            AttachmentTable.AddAttachment(this.File, attachment);
        }
 public AttachmentObject GetAttachmentObject(int attachmentIndex)
 {
     if (this.AttachmentTable != null)
     {
         uint             subnodeID = this.AttachmentTable.GetAttachmentSubnodeID(attachmentIndex);
         Subnode          subnode   = this.SubnodeBTree.GetSubnode(subnodeID);
         AttachmentObject result    = new AttachmentObject(subnode);
         return(result);
     }
     else
     {
         return(null);
     }
 }
        public int GetTotalSizeOfAllAttachments()
        {
            int result = 0;

            for (int index = 0; index < this.AttachmentCount; index++)
            {
                AttachmentObject attachment     = GetAttachmentObject(index);
                Nullable <int>   attachmentSize = attachment.PC.GetInt32Property(PropertyID.PidTagAttachSize);
                if (attachmentSize.HasValue)
                {
                    result += attachmentSize.Value;
                }
            }
            return(result);
        }
示例#8
0
        public static AttachmentObject CreateNewExceptionAttachmentObject(PSTFile file, SubnodeBTree subnodeBTree)
        {
            AttachmentObject attachment = CreateNewAttachmentObject(file, subnodeBTree);

            attachment.PC.SetStringProperty(PropertyID.PidTagDisplayName, "Untitled");
            attachment.PC.SetStringProperty(PropertyID.PidTagAttachEncoding, String.Empty);
            //attachment.PC.SetBytesProperty(PropertyID.PidTagAttachRendering, AppointmentAttachRendering);

            attachment.PC.SetInt32Property(PropertyID.PidTagAttachMethod, (int)AttachMethod.EmbeddedMessage);
            attachment.PC.SetInt32Property(PropertyID.PidTagAttachFlags, 0);
            attachment.PC.SetInt32Property(PropertyID.PidTagAttachmentFlags, (int)AttachmentFlags.afException);
            attachment.PC.SetInt32Property(PropertyID.PidTagAttachmentLinkId, 0);
            attachment.PC.SetInt32Property(PropertyID.PidTagRenderingPosition, -1);

            attachment.PC.SetBooleanProperty(PropertyID.PidTagAttachmentHidden, true);
            attachment.PC.SetBooleanProperty(PropertyID.PidTagAttachmentContactPhoto, false);

            attachment.CreateSubnodeBTreeIfNotExist();

            return(attachment);
        }
        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);
        }