The IMessage::CreateAttach method creates a new attachment.
See IMessage : IMAPIProp.
HRESULT CreateAttach(
LPCIID lpInterface,
ULONG ulFlags,
ULONG FAR * lpulAttachmentNum,
LPATTACH FAR * lppAttach
);
The IMessage::CreateAttach method creates a new attachment within a message. The new attachment and any properties that are set for it are not available until a client has called the attachment's IMAPIProp::SaveChanges method and the message's IMAPIProp::SaveChanges method. Both the attachment and its message have to be saved before the attachment is included in the message's attachment table.
The attachment number pointed to by lpulAttachmentNum is unique and valid only within the context of the message. That is, two attachments in two different messages can have the same number while two attachments in the same message cannot.