Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Outlook / Programming VBA / March 2007

Tip: Looking for answers? Try searching our database.

problem using Parent property of MailItem

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
kf9150@gmail.com - 30 Mar 2007 18:08 GMT
hello, what i'm trying to do is moving the MailItem just sent to
appropriate folder if needed. but before that, i need to check from
which folder the mail was sent. using following code, the returned
parent folder name is always "inbox" no matter which folder the mail
was sent from. any suggestion? thanks for help. - kelie

Private Sub Application_ItemSend(ByVal Item As Object, Cancel As
Boolean)
   Dim objMail As MailItem

   If TypeOf Item Is MailItem Then
       Set objMail = Item
       Debug.Print objMail.Parent.Name
   End If
End Sub
Dmitry Streblechenko - 30 Mar 2007 18:26 GMT
What exactly do you mean by "from which folder the mail was sent"? When you
create a new message, Outlook creates it in the Inbox (but does not save
it). Once you save it, it goes to the Drafts folder.
Do you mean you need to find which folder was displayed in the Explorer when
the  message was sent? Application.ActiveExplorer.CurrentFolder will give
you that.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy  - Outlook, CDO
and MAPI Developer Tool

> hello, what i'm trying to do is moving the MailItem just sent to
> appropriate folder if needed. but before that, i need to check from
[quoted text clipped - 11 lines]
>    End If
> End Sub
kf9150@gmail.com - 30 Mar 2007 18:50 GMT
> What exactly do you mean by "from which folder the mail was sent"? When you
> create a new message, Outlook creates it in the Inbox (but does not save
[quoted text clipped - 6 lines]
> OutlookSpy  - Outlook, CDO
> and MAPI Developer Tool

Dmitry, thanks for your reply. i have many folders created for
different projects i'm working on. in each folder there are emails for
a paticular project. when i reply emails from such folder, the parent
folder should be that folder, instead of "inbox", is it correct?
thanks.
Dmitry Streblechenko - 30 Mar 2007 21:33 GMT
No, the parent folder will be the Inbox, Drafts or Sent Items.
There is no hard link between the message being replied to and the reply.

1. You can watch the selection change event in all Explorer objects and set
up event sinks on all selected items. You will then receive the
MailItem.Reply event
whenever the user hits Reply button. That will be the original message and
MailItem.Parent on that message will give you the fodler.
2. Retrieve the value of the ConversationIndex property, delete the last 5
bytes (10 chars since OOM returns it as a hex string), then try to find a
message with that conversation index, hoping that the selected folder is
where the old message lives. Or search all teh relevant folders.
3. You can assume that whenever Inspectors.NewInspector even fires,
Application.ActiveExplorer.Selection or
Application.ActiveInspector.CurrentItem will give you the original item(s).

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy  - Outlook, CDO
and MAPI Developer Tool

>> What exactly do you mean by "from which folder the mail was sent"? When
>> you
[quoted text clipped - 14 lines]
> folder should be that folder, instead of "inbox", is it correct?
> thanks.
kf9150@gmail.com - 31 Mar 2007 09:39 GMT
On Mar 30, 10:33 am, "Dmitry Streblechenko" <dmi...@dimastr.com>
wrote:
> No, the parent folder will be the Inbox, Drafts or Sent Items.
> There is no hard link between the message being replied to and the reply.

Thanks again Dmitry. i'll try your suggested methods, probably the
first one and the third one, and see if i can work something out.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.