private void LoadAttachmentStorage(NativeMethods.IStorage storage)
{
//create attachment from attachment storage
Attachment attachment = new Attachment(new OutlookStorage(storage));
//if attachment is a embeded msg handle differently than an normal attachment
int attachMethod = attachment.GetMapiPropertyInt32(OutlookStorage.PR_ATTACH_METHOD);
if (attachMethod == OutlookStorage.ATTACH_EMBEDDED_MSG)
{
//create new Message and set parent and header size
Message subMsg = new Message(attachment.GetMapiProperty(OutlookStorage.PR_ATTACH_DATA) as NativeMethods.IStorage);
subMsg.parentMessage = this;
subMsg.propHeaderSize = OutlookStorage.PROPERTIES_STREAM_HEADER_EMBEDED;
//add to messages list
this.messages.Add(subMsg);
}
else
{
//add attachment to attachment list
this.attachments.Add(attachment);
}
}