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
        private void GetAttachNames(out MailAttach[] att)
        {
            att = new MailAttach[lastMsg.fileCount];
            Type fdtype = typeof(MapiFileDesc);
            int  fdsize = Marshal.SizeOf(fdtype);
            var  fdtmp  = new MapiFileDesc();
            var  runptr = lastMsg.files.ToInt64();

            for (int i = 0; i < lastMsg.fileCount; i++)
            {
                var ptrDest = new IntPtr(runptr);
                Marshal.PtrToStructure(ptrDest, fdtmp);
                runptr += fdsize;
                att[i]  = new MailAttach();
                if (fdtmp.flags == 0)
                {
                    att[i].position = fdtmp.position;
                    att[i].name     = fdtmp.name;
                    att[i].path     = fdtmp.path;
                }
            }
        }
Beispiel #3
0
		private void GetAttachNames(out MailAttach[] aat)
		{
			aat = new MailAttach[lastMsg.fileCount];
			Type fdtype = typeof (MapiFileDesc);
			int fdsize = Marshal.SizeOf(fdtype);
			var fdtmp = new MapiFileDesc();
			var 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 #4
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;
		}