how to change sent item status in outlook 2003

Hello, I'm using outlook 2003. this question is a follow up to Question ID:25809502 where I learned that in order to seperate personal (pop3 hotmail) from work (exchange server) in order that it not sync up - I should create a .pst file and a rule to send all the hotmail to that.
this solution works great as far as I can tell, except for one thing -- when I SEND an email from the hotmail - it still puts that email into sent items of the exchange server and syncs.  I created an "after rule" to "copy" it to the sent items of the .pst - and that works... but a copy also goes to the other sent items. any way to fix that?
thanks!!
jpomerantzAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

 
Glen KnightCommented:
Not using the current versions of outlook.
They have a PRIMARY account and this is where your sent items will go regardless of which account you send then from.

This behaviour has changed in Outlook 2010 which is currently available as BETA amd expected to be released June/July time.
0
 
Chris BottomleySoftware Quality Lead EngineerCommented:
Assuming you are sending the email from teh pst via the account button then we could code something so that the save folder is in the hotmail pst ... assuming VBA is acceptable?

Chris
0
 
Mansoor NathaniCommented:
Try creating a rule to "move" the email from the sent items into the .pst folder, rather than copying it which will not move it
0
Creating Active Directory Users from a Text File

If your organization has a need to mass-create AD user accounts, watch this video to see how its done without the need for scripting or other unnecessary complexities.

 
jpomerantzAuthor Commented:
I'd be open to vba - but you'll have to walk me through what it should be and where exactly to put it :) (I'm familiar with where vba goes in access but not in outlook...)

I tried making a rule to move - but I can't seem to find such an option in the list... the only one is "send copy to..." (there is a "perform custom action" rule - but it shows a blank dialog box and i don't know how to program this)

thanks so much for your help!
0
 
Chris BottomleySoftware Quality Lead EngineerCommented:
The following script will do that ... late for me so i'll check back tomorrow:

Set the folder path from the PST down through  the subfolders where the mail should go and set the email address of the sending account for which the function is required.

Chris

To Create a macro:
------------------

Alt + F11 to open the macro editor

  For Applicationevent handlers:
     In the project tree select as appropriate:
      OUTLOOK      : thisOutlookSession
     In the workpane select as appropriate:
      OUTLOOK      : Application
     In the workpane select the required 'event', (i.e. 'item_Send').
     Either
        Insert the required code from the supplied sub into the selected subroutine.
     Or
        Replace the template inserted by the VBE with the sub as supplied

           
Close the Visual Basic Editor.

Check Security as appropriate:
------------------------------

In the application select Tools | Macro | Security
2003 and Earlier : Select Medium
In the application select Windows Office Button | Trust Centre | Trust Centre Settings | Trusted Locations | Add your folder where you will run the file from
In the application select Windows Office Button | Trust Centre | Trust Centre Settings | Macro Settings | MAcro Settings - Disable with notification
Select OK


Private Sub Application_ItemSend(ByVal item As Object, Cancel As Boolean)
    
    If LCase(item.SendUsingAccount.DisplayName) = "Second address detail check caps!!!" Then Set item.SaveSentMessageFolder = Application.Session.folders("PSTNAME").folders("foldername")

End Sub

Open in new window

0
 
jpomerantzAuthor Commented:
ok... I think I had you till where you said:
In the application select Windows Office Button | Trust Centre | Trust Centre Settings | Trusted Locations | Add your folder where you will run the file from
In the application select Windows Office Button | Trust Centre | Trust Centre Settings | Macro Settings | MAcro Settings - Disable with notification
Select OK
-- sorry to sound stupid... what is the "windows office button?? :)
tried to send an email without this and the whole thing froze then I finally got an error that something was wrong with the code... when I tried a second time - the email sent - but it didn't work. interestingly, my rule didn't either work... that is to say, i didn't even get a copy in the .pst "sent items" folder...
I'm attaching a screenshot of the macro as I have it now - does it look right? (I'm also attaching the code... i'm noticing that it still shows up hightlighted... is that a prob?
thanks so so much for your help!!
Private Sub Application_ItemSend(ByVal item As Object, Cancel As Boolean)
     
    If LCase(item.SendUsingAccount.DisplayName) = "joelpsych@hotmail.com" Then Set item.SaveSentMessageFolder = Application.Session.Folders("outlook_backup_2-8-09_joelpsych.pst").Folders("Sent_Items")
 
End Sub

Open in new window

screenshot-10.doc
0
 
jpomerantzAuthor Commented:
ok - after a couple minutes the rule did work and the emails did send - but there was still a copy in the exchange sent items folder so the code didn't work...
0
 
jpomerantzAuthor Commented:
tried it again and again it froze - and after a few seconds gave "runtime error 438; object does not support this property or method" - and when you start debugger - highlights that line as in the above screenshot...

the test email stays frozen in a word window until you open and close the debugger - at which time the email sends fine - but does go into both sent items folders...

I did notice that it gives me warning message about macros when opening outlook - I'm assuming that has to do with the security settings that I couldn't figure out :)

sorry for the serial postings here. I really appreciate your help getting this working!!
0
 
Chris BottomleySoftware Quality Lead EngineerCommented:
I have edited my common text for security so it is in fact unclear but for 2003:

2003 and Earlier : Select Medium

Is it, have you done this, and if so try exiting restarting outlook you will get a warning on start where you need to enable macros ... and also later on but if so those subsequesnt ones can be disabled via an add-in.

First thing is see if it seems to function correctly

Chris
0
 
jpomerantzAuthor Commented:
have done that, and I do get the warning when starting Outlook - but no, the code does not seem to work. still giving the error (runtime error 438 etc...) and opens debugger - highlighting that first line with the email address... and the email goes into both sent items folders...
any ideas?
thanks so so much!
0
 
Chris BottomleySoftware Quality Lead EngineerCommented:
Set the cursor in the folder where you want the emails to go and then in the VBE immediate window, ctrl + G to display type:

?application.ActiveExplorer.CurrentFolder.FolderPath

Then let me know the string it returns and i'll correct the code you are using ... the syntax of your edit is wrong and this is teh easy way to resolve it.

Chris
0
 
jpomerantzAuthor Commented:
this is what it says:
\\hotmail joelpsych\Sent Items

thnaks so so much!!
0
 
Chris BottomleySoftware Quality Lead EngineerCommented:
In that case try:

Chris
Private Sub Application_ItemSend(ByVal item As Object, Cancel As Boolean) 
      
    If LCase(item.SendUsingAccount.DisplayName) = "joelpsych@hotmail.com" Then Set item.SaveSentMessageFolder = Application.Session.Folders("hotmail joelpsych").Folders("Sent Items") 
  
End Sub

Open in new window

0
 
jpomerantzAuthor Commented:
no luck. same problem.
the debugger is highlighting this part:
If LCase(item.SendUsingAccount.DisplayName) = "joelpsych@hotmail.com" Then

thanks!
0
 
jpomerantzAuthor Commented:
I have to run for a few hours... I'll check back
I'm really eager to get this working right :) thanks so much for your help!!
0
 
jpomerantzAuthor Commented:
I'm just curious... at the end of this - will we be able to eliminate the macro warning altogether? i didn't clearly understand that
thanks
0
 
Chris BottomleySoftware Quality Lead EngineerCommented:
The initial warning on open, yes either by using a commercial code signing certificate or a self cert if the app is installed.

Warnings on accessing items, probably depending on permissions.  Basically adding an add-in will probably cure it one way or another.

Chris
0
 
jpomerantzAuthor Commented:
ok thanks
any ideas about how to get the macro to work? :)
0
 
jpomerantzAuthor Commented:
could there be something wrong with the email address since that's the part it's highlighting? I don't know too much about vba!
thanks!
0
 
Chris BottomleySoftware Quality Lead EngineerCommented:
OK, I am too familiar with 2007, SendUsingAccount looks as though it's  new in outlook 2007.  I believe it can be worked around using CDO but I need to find a 2003 PC and enable that to make a test.  I may be a few days but if no-one else gets a working solution to you and a couple of days elapse ... please ping me.

Chris
0
 
jpomerantzAuthor Commented:
ok - thanks, I really appreciate it Chris! I didn't know there was a way on this site to specifically ping experts... how do you do that? or, do I just put a post here and it will go to you cuz you're following it?
0
 
Chris BottomleySoftware Quality Lead EngineerCommented:
sorry, I meant post to the thread which means I get the email prompt ... ping just seemed so simple to say!

DO you know if you have CDO installed on your PC?

Chris
0
 
jpomerantzAuthor Commented:
don't know off hand... how do I check? the computer is new and has windows 7 pro and office 2003; does CDO come standard with any of this?
0
 
Chris BottomleySoftware Quality Lead EngineerCommented:
THat's part of my dilemma, my 2003 machine doesn't have CDO and so far i've failed to activate it ... I was simply hoping you had an answer ... such is life however.  I will return to that issue later today.

Chris
0
 
jpomerantzAuthor Commented:
wish I knew... if there's a place I could look or way that I could tell - just holler and I'll check :) thanks so so much!!
it is a new windows 7 machine, if that's any help...
0
 
Chris BottomleySoftware Quality Lead EngineerCommented:
I have installed CDO onto my other pc and the basic concept works ... SO!

Insert a normal code module into the VBE and then paste the snippet therein:

Chris
Function GetFromAddress(objMsg)
Dim objSession As Object
Dim objCDOMsg As Object
Dim strEntryID As String
Dim strStoreID As String
Dim strAddress As String

    Set objSession = CreateObject("MAPI.Session")
    objSession.Logon "", "", False, False
    strEntryID = objMsg.EntryID
    strStoreID = objMsg.Parent.StoreID
    Set objCDOMsg = objSession.GetMessage(strEntryID, strStoreID)
    On Error Resume Next
    strAddress = objCDOMsg.Sender.Address
    If Err = &H80070005 Then
        MsgBox "You must accept the security prompt re accessing the mail address", vbExclamation
    End If
    GetFromAddress = strAddress
 
    Set objCDOMsg = Nothing
    objSession.Logoff
    Set objSession = Nothing
End Function

Open in new window

0
 
Chris BottomleySoftware Quality Lead EngineerCommented:
Now modify the itemsend sub as below and see if it works.  If it doesn't then close outlook and via install software icon find the outlook application and modify it ... you should find collaboration data objects - enable the feature and install it.

Restart outlook and try again.  You will most likely get security messages but if this basic capability is there perhaps that can be addressed via a new question since I will likely be offline for a while (and I think at the point the main feature is working is a good one to close out this question).

If it still isn't working then lets keep at it here till it is.

Chris
Private Sub Application_ItemSend(ByVal item As Object, Cancel As Boolean)  
       
    If LCase(GetFromAddress(Item)) = "joelpsych@hotmail.com" Then Set item.SaveSentMessageFolder = Application.Session.Folders("hotmail joelpsych").Folders("Sent Items")  
   
End Sub

Open in new window

0
 
jpomerantzAuthor Commented:
wow! thanks so so much
I'm going to switch computers right now and try it. i hope you're still there :)
I'll post back in a few
0
 
Chris BottomleySoftware Quality Lead EngineerCommented:
still here for 1/2 hr or so
0
 
jpomerantzAuthor Commented:
awesome - ok, I'm on the proper machine - trying it now....
0
 
jpomerantzAuthor Commented:
ok - got the error... where's the "install software icon"?
sorry - I'm totally new to windows 7 - got it two weeks ago :)
0
 
jpomerantzAuthor Commented:
found it!! i think I enabled it correctly.
tried and got error... the debugger highligted this line:
Set objCDOMsg = objSession.GetMessage(strEntryID, strStoreID)

any ideas?? did I do it wrong??
0
 
jpomerantzAuthor Commented:
gosh, I hope yur still there :)
0
 
Chris BottomleySoftware Quality Lead EngineerCommented:
I'm even newer to win 7 ... haven't got haven't seen it i'm assuming it's close to vista.

Try hovering the mouse over strEntryID  and strStoreID what do you get?

Note also that when I disappear simply comment out the line in Application_ItemSend to avoid the error messages for the duration and re-enable tomorrow as we pick up again.

Chris


Private Sub Application_ItemSend(ByVal item As Object, Cancel As Boolean)   
        
'    If LCase(GetFromAddress(Item)) = "joelpsych@hotmail.com" Then Set item.SaveSentMessageFolder = Application.Session.Folders("hotmail joelpsych").Folders("Sent Items")   
    
End Sub

Open in new window

0
 
jpomerantzAuthor Commented:
when I hover over it  - it says:
StrEntryID=""
0
 
Chris BottomleySoftware Quality Lead EngineerCommented:
Stupid question but you are triggering it by sending a message?

Chris
0
 
jpomerantzAuthor Commented:
sure am.
0
 
Chris BottomleySoftware Quality Lead EngineerCommented:
Against my normal practices I errored out in the post ... could be a factor.  Replace:

Function GetFromAddress(objMsg)
with
Function GetFromAddress(objMsg as object)

Chris
0
 
jpomerantzAuthor Commented:
no luck. same thing happening...
0
 
jpomerantzAuthor Commented:
any ideas? strange that it worked for you...
0
 
Chris BottomleySoftware Quality Lead EngineerCommented:
First off apologies for missing the previous post.  Can you supply the code you are using so I can see if there is an error there.  Identify which code modules and typres the code is in, (exact names do not matter but any split of code between modules could.

Chris
0
 
jpomerantzAuthor Commented:
no problem!! as you can tell also - i've been in and out here over the weekend :)
thanks so much for sticking with me to get this working - I'll for sure end the question once the macro works.

ok - here's the code that is in the part called "this outlook session"

Private Sub Application_ItemSend(ByVal item As Object, Cancel As Boolean)
        
    If LCase(GetFromAddress(item)) = "joelpsych@hotmail.com" Then Set item.SaveSentMessageFolder = Application.Session.Folders("hotmail joelpsych").Folders("Sent Items")
    
End Sub

Open in new window

0
 
jpomerantzAuthor Commented:
and here's the code that's in the new module that I created called "module1" under "modules":
Function GetFromAddress(objMsg As Object)
Dim objSession As Object
Dim objCDOMsg As Object
Dim strEntryID As String
Dim strStoreID As String
Dim strAddress As String
 
    Set objSession = CreateObject("MAPI.Session")
    objSession.Logon "", "", False, False
    strEntryID = objMsg.EntryID
    strStoreID = objMsg.Parent.StoreID
    Set objCDOMsg = objSession.GetMessage(strEntryID, strStoreID)
    On Error Resume Next
    strAddress = objCDOMsg.Sender.Address
    If Err = &H80070005 Then
        MsgBox "You must accept the security prompt re accessing the mail address", vbExclamation
    End If
    GetFromAddress = strAddress
  
    Set objCDOMsg = Nothing
    objSession.Logoff
    Set objSession = Nothing
End Function

Open in new window

0
 
jpomerantzAuthor Commented:
and here's a screenshot of the vbe window in case that would be helpful... (the part with the module showing...)

thanks SOOO much!
screenshot-2.doc
0
 
jpomerantzAuthor Commented:
hope all that helps and that you're around :) I should be here for a few hours now so if you're there - that would be cool otherwise, whenever's good!
thanks again!!
0
 
Chris BottomleySoftware Quality Lead EngineerCommented:
Not feeling too good at the moment so apologies ... What kind of message are you sending ... i.e. basic email message, invitation or something else.

Also do you use encryption?

Chris
0
 
jpomerantzAuthor Commented:
so sorry! hope you feel better fast!!
it's just regular email message... I don't think I use encryption. would that be set as default or would it be something I would have had to set up? (if the latter than for sure not cuz I didn't set anything up like that)
0
 
Chris BottomleySoftware Quality Lead EngineerCommented:
kay fundamental error in my approach, I tested it it on an existing email.  Can you install redemption ... I think that will give a way forward.

http://www.dimastr.com/redemption

Cheeck the add-in in VBA and i'l hopefully get back to you tomorrow

Chris
0
 
Chris BottomleySoftware Quality Lead EngineerCommented:
Redemption has the same issue ... just tested it, the following approach however does seem to work

Basically I wait until the mailitem hits the sent items folder at which time it is fully populated and I do the test then to see if it should be moved.

The question is therefore back to the basic concept asked earlier by mnathani.  Can you modify your rule to move the mail reather than copy it?  If so then hopefully that'll do the trick and they get the points and if it doesn't work then we can try my last resort as outlined above.

Chris
0
 
jpomerantzAuthor Commented:
I can't figure out how to make a rule like that... I tried that way back when. the only rule in there under category for "after you send an item" is "copy" -- there is no "move from folder to folder" rule available that I can find.

what is your "last resort" - I think I am confused at this point. I didn't understand the last suggestion exactly about downloading. are you now saying not to try that? or yes to try it?
thanks so much!
0
 
Chris BottomleySoftware Quality Lead EngineerCommented:
Sorry for the confusion:

1. Just checked you're correct there is only the move option for sent mails.
2. The add-in I suggested was to support a potential approach - which failed on my test this morning so ignore for now.
3. I have an equivalent of the move rule as follows:

Some code I will supply for thisOutlookSession to detect a mail dropping into the sent items folder, when detected test the sender email and if it is 'the' one move the item to the new location.  It comprises the following after which outlook should be restarted:

Chris
'1 - Define the event handler
Private WithEvents olksentitems As Items

'2 - Initialise the event handler
Private Sub Application_Startup()
    Set olksentitems = objNS.GetDefaultFolder(olFolderSentMail).Items
End SUb

'3 - Implement the selective move
Private Sub olksentitems_ItemAdd(ByVal item As Object)
    If LCase(item.sendereMailAddress) = "joelpsych@hotmail.com" Then item.Move Application.Session.folders("hotmail joelpsych").folders("Sent Items")
End Sub

Open in new window

0

Experts Exchange Solution brought to you by ConnectWise

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
 
Chris BottomleySoftware Quality Lead EngineerCommented:
Delete / disble the earlier code as this code above completely replaces that/those attempts.

Chris
0
 
jpomerantzAuthor Commented:
lol - I was JUST about to post asking if that's what ya meant :)
ok - trying it right now...
0
 
jpomerantzAuthor Commented:
ok - when starting outlook - if I select "enable macros" it automatically gives runtime error 424 - 'object required' and the debugger highlights:

 Set olksentitems = objNS.GetDefaultFolder(olFolderSentMail).Items

any ideas?
0
 
Chris BottomleySoftware Quality Lead EngineerCommented:
HAcking about too much!, that was for my test snippet which I didn't fully convert.  Hopefully this is correct.

Chris
Private Sub Application_Startup() 
    Set olksentitems = application.session.GetDefaultFolder(olFolderSentMail).Items 
End SUb 

Open in new window

0
 
jpomerantzAuthor Commented:
it  WOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOORRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKSSSSSSSSSSSSSSSSS!!!!

sorry... just a little excited there...
thanks so so so much for hanging in there to help me get this going!
0
 
jpomerantzAuthor Commented:
thank you so so much Chris for sticking with this! wow, I'm really excited. you explained it clearly and with so much patience that even a newbie like me could figure it out and get it working. I really appreciate your time and patience. hope you're feeling better :) I'll open a new question now about the error message - jump in for an easy 500 points! :) :)
0
 
Chris BottomleySoftware Quality Lead EngineerCommented:
Sorry it took me so long!, it's been a long while since I encountered so fundamentally different between 2007/2003.

Chris
0
 
jpomerantzAuthor Commented:
no prob! all's well that ends well. it is interesting that they changed it like that so fundamentally it seems...
just posted the other question.
thanks again so much!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.