Beispiel #1
0
 private void GetAttachNames(out MailAttach[] aat)
 {
     aat = new MailAttach[lastMsg.fileCount];
     Type fdtype = typeof(MapiFileDesc);
     int fdsize = Marshal.SizeOf(fdtype);
     MapiFileDesc fdtmp = new MapiFileDesc();
     int runptr = (int)lastMsg.files;
     for (int i = 0; i < lastMsg.fileCount; i++)
     {
         Marshal.PtrToStructure((IntPtr)runptr, fdtmp);
         runptr += fdsize;
         aat[i] = new MailAttach();
         if (fdtmp.flags == 0)
         {
             aat[i].position = fdtmp.position;
             aat[i].name = fdtmp.name;
             aat[i].path = fdtmp.path;
         }
     }
 }
Beispiel #2
0
        // ----------------------------------------------------------- READING ---------

        public string Read(string id, out MailAttach[] aat)
        {
            aat = null;
            IntPtr ptrmsg = IntPtr.Zero;
            error = MAPIReadMail(session, winhandle, id,
                                    MapiPeek | MapiSuprAttach, 0, ref ptrmsg);
            if ((error != 0) || (ptrmsg == IntPtr.Zero))
                return null;

            lastMsg = new MapiMessage();
            Marshal.PtrToStructure(ptrmsg, lastMsg);

            if ((lastMsg.fileCount > 0) && (lastMsg.fileCount < 100) && (lastMsg.files != IntPtr.Zero))
                GetAttachNames(out aat);

            MAPIFreeBuffer(ptrmsg);
            return lastMsg.noteText;
        }