Outlook .. Propertyaccessor, setting property

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
Jovannb
Posts: 268
Joined: 17 Jun 2014, 02:44
Location: Austria

Outlook .. Propertyaccessor, setting property

11 Jan 2019, 16:54

Hi,

I'm dealing with my Outlook2010 Emails by this code

Code: Select all

#SingleInstance force	

; get selected-emails in Outlook-Explorer
Selected_Emails := COMObjActive("Outlook.Application").ActiveExplorer.Selection
counter := Selected_Emails.count	

; loop through Eplorer-selected-mails
loop, %counter%
{

	e_item:=Selected_Emails.Item(A_Index)
	
	; get Mapi-Mail-Properties
	m_test1 := e_Item.Propertyaccessor.Getproperty("http://schemas.microsoft.com/mapi/proptag/0x10820040") ;"PR_LAST_VERB_EXECUTION_TIME"
	m_test2 := e_Item.Propertyaccessor.Getproperty("http://schemas.microsoft.com/mapi/proptag/0x10810003") ;"PR_LAST_VERB_EXECUTED"
	m_test3 := e_Item.Propertyaccessor.Getproperty("http://schemas.microsoft.com/mapi/proptag/0x1035001E") ;"PR_INTERNET_MESSAGE_ID"
	
	; forwarded Mail  decimal 262 -> 0x106
	m_test4 := e_Item.Propertyaccessor.Getproperty("http://schemas.microsoft.com/mapi/proptag/0x10800003") ;"PR_ICON_INDEX"
	
	; wont work, why ?? 
	;e_Item.Propertyaccessor.SetProperty("http://schemas.microsoft.com/mapi/proptag/0x10800003") := 0x106 ;"PR_ICON_INDEX"
}
return
Everything works fine, except setting a property by using Propertyaccessor.SetProperty, I've no idea how to enter that syntax-correct.
Help available ?

Regards

J.B.
AHK: 1.1.37.01 Ansi, 32-Bit; Win10 22H2 64 bit, german
awel20
Posts: 211
Joined: 19 Mar 2018, 14:09

Re: Outlook .. Propertyaccessor, setting property

11 Jan 2019, 17:14

Code: Select all

; Error:  0x8002000E - Invalid number of parameters.
; e_Item.Propertyaccessor.SetProperty("http://schemas.microsoft.com/mapi/proptag/0x10800003") := 0x106 ;"PR_ICON_INDEX"

Code: Select all

e_Item.Propertyaccessor.SetProperty("http://schemas.microsoft.com/mapi/proptag/0x10800003", 0x106)  ;"PR_ICON_INDEX"
; https://docs.microsoft.com/en-us/office/vba/api/Outlook.PropertyAccessor.SetProperty
;  "If the parent object of the PropertyAccessor supports an explicit Save operation, then the properties should be saved
;  to the object with an explicit Save method call. [...] Use caution and ensure that all exceptions are handled 
;  correctly. Conditions where setting properties fails include..."
e_Item.Save

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: zerox and 320 guests