Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Current Selected Item in Outlook
#1
while looking at an email in the preview pane in Outlook, I'd like to be able to set the "Expires After" time without opening it.

I can't seem to find how to get ahold of the current selected item with QM. Everything seems to be based on triggers but there isn't a trigger, I just want it to act on the item I'm looking at.

here's what's failed so far.

Macro Macro
Code:
Copy      Help
function IDispatch'item ;;Outlook._Items'items
out
Outlook.Application a._getactive
Outlook.NameSpace ns=a.Session
Outlook.MailItem ci=item
ci.UnRead

anyone have any ideas?
An old blog on QM coding and automation.

The Macro Hook
#2
Macro Macro1928
Code:
Copy      Help
typelib Outlook {00062FFF-0000-0000-C000-000000000046} 9.2
Outlook.Application app._getactive
;get selected message
Outlook.MailItem msg=app.ActiveExplorer.Selection.Item(1); err out "no selection"; ret
out msg.Subject
#3
never would have gotten there. thanks!!
An old blog on QM coding and automation.

The Macro Hook
#4
I keep getting an "object" not found error on this
Macro Expire Message-1 week
Trigger f //FF_Keyboard2     Help - how to add the trigger to the macro
Code:
Copy      Help
str foldername="Temp"
Outlook.Application app._getactive
Outlook.MailItem msg=app.ActiveExplorer.Selection.Item(1); err out "no selection"; ret
Outlook.MAPIFolder froot=app.GetNamespace("MAPI").Folders.Item(1)
Outlook.MAPIFolder fdest=froot.Folders.Item(foldername)

_s.timeformat("{D}")
DATE z=_s
z=z+7
msg.ExpiryTime=z
msg.Move(fdest)

I found the MAPIFolder lines from move message in Outlook (one of my messages from almost 7 years ago)...(wait...7 YEARS???!!!! SWEET FANCY MOSES!! I will have been here for 10 YEARS on Feb 19th!!!...wow....10 years... Confusedhock: ..)....anyway...and am sure that I have a folder named "Temp" as a root folder (that is on the same level with Inbox, Draft, Sent, etc.). What am I missing here, typelib declaration maybe? or is it the fact I'm on 2010 make the difference?
thanks...10 years....
An old blog on QM coding and automation.

The Macro Hook
#5
I didn't test with 2010. Maybe need to change typelib declaration.
Usually "object not found" when QM runs as admin or uiAccess. Let the macro run in separate process as User.
#6
thanks.
I added the typelib from one of my other Outlook macs and ran it as several different user types but still same error on line with "fdest".
any other thoughts?

error line
Macro Expire Message-1 week
Trigger f //FF_Keyboard2     Help - how to add the trigger to the macro
Code:
Copy      Help
Outlook.MAPIFolder fdest=froot.Folders.Item(foldername)

typelib line
Macro Expire Message-1 week
Trigger f //FF_Keyboard2     Help - how to add the trigger to the macro
Code:
Copy      Help
typelib Outlook2 {00062FFF-0000-0000-C000-000000000046} 9.4
An old blog on QM coding and automation.

The Macro Hook
#7
Can test only with Office 2003. Works.
Macro Macro1931
Code:
Copy      Help
;/exe 1
typelib Outlook {00062FFF-0000-0000-C000-000000000046} 9.2
str foldername="Temp"
Outlook.Application app._getactive
Outlook.MailItem msg=app.ActiveExplorer.Selection.Item(1); err out "no selection"; ret
Outlook.MAPIFolder froot=app.GetNamespace("MAPI").Folders.Item(1)
Outlook.MAPIFolder fdest=froot.Folders.Item(foldername)
out fdest
#8
ok, here's what I did and got it to work, however, I can only narrow it down to one of 3 things.
[list=]I compacted my default "ost" data file in the account settings
I closed all my external "pst" files
opened 1st pst file and tried ->success
opened 2nd pst file and tried ->success
opened 3rd pst file and tried ->success
[/list]

it worked each time when I opened up the pst's . unfortunately I didn't try it after doing a compact so I don't know if it was the archive file steps or compact but now it works!!!

thanks.




Macro Expire Message-1 week
Trigger f //FF_Keyboard2     Help - how to add the trigger to the macro
Code:
Copy      Help
typelib Outlook2 {00062FFF-0000-0000-C000-000000000046} 9.4
str foldername="Temp"
Outlook.Application app._getactive
Outlook.MailItem msg=app.ActiveExplorer.Selection.Item(1); err out "no selection"; ret
Outlook.MAPIFolder froot=app.GetNamespace("MAPI").Folders.Item(1)
Outlook.MAPIFolder fdest=froot.Folders.Item(foldername)

_s.timeformat("{D}")
DATE z=_s
z=z+7
msg.ExpiryTime=z
msg.Move(fdest)
An old blog on QM coding and automation.

The Macro Hook
#9
dang...almost there.
I'm trying to now mark it as read but it doesn't seem to be doing the Unread="False" thing. I've tried 'save' and doing it in differ order but nothing works.

anyone marked something as read in this sort of context?

PS: I looked up 'Update' wasn't available.

Macro Expire Message-1 week
Trigger f //FF_Keyboard2     Help - how to add the trigger to the macro
Code:
Copy      Help
typelib Outlook2 {00062FFF-0000-0000-C000-000000000046} 9.4
str foldername="Temp"
Outlook.Application app._getactive
Outlook.MailItem msg=app.ActiveExplorer.Selection.Item(1); err out "no selection"; ret
Outlook.MAPIFolder froot=app.GetNamespace("MAPI").Folders.Item(1)
Outlook.MAPIFolder fdest=froot.Folders.Item(foldername)

_s.timeformat("{D}")
DATE z=_s
z=z+7
msg.UnRead = "False"
msg.Save
msg.ExpiryTime=z
;msg.Move(fdest)
An old blog on QM coding and automation.

The Macro Hook
#10
nevermind :roll:

the syntax is
Macro Expire Message-1 week
Trigger f //FF_Keyboard2     Help - how to add the trigger to the macro
Code:
Copy      Help
msg.UnRead = 0

thanks though!
An old blog on QM coding and automation.

The Macro Hook


Forum Jump:


Users browsing this thread: 2 Guest(s)