Accessing Modification Time of an Outlook Mail in Python

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Accessing Modification Time of an Outlook Mail in Python

venu madhav-4
Hi all,
       I am writing a small application which reads the contents of an
Outlook Mail using python. I am able to read the contents, subject
along with senders and receivers of a mail using MAPI objects. But may
I know how can I get access to the "modification time" or the
receiving time of an outlook mail in Python. For the others I have
used message object of MAPI session. Here I am pasting a sample code
to get an idea of what am I doing.


session = Dispatch("MAPI.session")
session.Logon('outlook')  # MAPI profile name
inbox = session.Inbox

print "Inbox name is:", inbox.Name
print "Number of messages:", inbox.Messages.Count

for i in range(inbox.Messages.Count):
    message = inbox.Messages.Item(i + 1)

objSender = message.Sender.Address
objRecip = message.Recipients.Item(j+1)


Now here I want to access the modification time of each mail. And if
possible if you can guide me to a place where I can get the elements
of that message object, that would be helpful.

 Please mail back for further information.
Thanks in advance,
Venu.
--
http://mail.python.org/mailman/listinfo/python-list
Reply | Threaded
Open this post in threaded view
|

Re: Accessing Modification Time of an Outlook Mail in Python

Iain King
On Nov 25, 5:11 am, "[hidden email]"
<[hidden email]> wrote:

> Hi all,
>        I am writing a small application which reads the contents of an
> Outlook Mail using python. I am able to read the contents, subject
> along with senders and receivers of a mail using MAPI objects. But may
> I know how can I get access to the "modification time" or the
> receiving time of an outlook mail in Python. For the others I have
> used message object of MAPI session. Here I am pasting a sample code
> to get an idea of what am I doing.
>
> session = Dispatch("MAPI.session")
> session.Logon('outlook')  # MAPI profile name
> inbox = session.Inbox
>
> print "Inbox name is:", inbox.Name
> print "Number of messages:", inbox.Messages.Count
>
> for i in range(inbox.Messages.Count):
>     message = inbox.Messages.Item(i + 1)
>
> objSender = message.Sender.Address
> objRecip = message.Recipients.Item(j+1)
>
> Now here I want to access the modification time of each mail. And if
> possible if you can guide me to a place where I can get the elements
> of that message object, that would be helpful.
>
>  Please mail back for further information.
> Thanks in advance,
> Venu.

This looks like the API for the Message object:
http://msdn.microsoft.com/en-us/library/ms526130(EXCHG.10).aspx
Looks like you want TimeLastModified

Iain
--
http://mail.python.org/mailman/listinfo/python-list
Reply | Threaded
Open this post in threaded view
|

Re: Accessing Modification Time of an Outlook Mail in Python

Skip Montanaro-3
In reply to this post by venu madhav-4

    Venu> ... may I know how can I get access to the "modification time" or
    Venu> the receiving time of an outlook mail in Python...

I have no idea off the top of my head, but you might want to browse the
SpamBayes Outlook plugin source code for various ways to manipulate Outlook
messages.

    http://spambayes.svn.sourceforge.net/viewvc/spambayes/trunk/spambayes/Outlook2000/

--
Skip Montanaro - [hidden email] - http://smontanaro.dyndns.org/
--
http://mail.python.org/mailman/listinfo/python-list