Posts: 1,058
Threads: 367
Joined: Oct 2007
Dear Gintaras,
I would appreciate any help on the following issue :
Supposed that I searched in an OE folder using
Quote:oe.GetMessages(f am)
that is without flag set to 1. I have found the record matching my requirements and I would like to obtain for this particular record its source, probably through
Quote:OEMESSAGE& m=am[n-j] and m.cbMessage
Many thanks in advance for any advice.
Posts: 1,058
Threads: 367
Joined: Oct 2007
This is a first approximation, no need to say that although it works, I am not satisfied with it.
Member function
COeMessages.GetMessageN
function OEFOLDER&folder ARRAY(OEMESSAGE)&a int'N int&nMess
str si.getmacro(getopt(itemid) 1)
str caller.getmacro(getopt(itemid 1) 1);err caller=si
if ideb; min 0; err out "<>%s : <open ''%s /%i''>%s</open> - Called by : %s" NowT si _error.place si caller
;Gets message N (from starting from Last) in a folder.
;SES : 140118
;folder - a folder retrieved by GetFolders or some other function.
;a - receives message info. OEMESSAGE contains the same info as MESSAGEPROPS, documented in MSDN library.
ref MSOEAPI
if(!ns) end ES_INIT
a=0
if(!folder.cMessage) ret
int h lp i
IStoreFolder f
ns.OpenFolder(folder.folderId 0 &f); err ret ;;'unspecified error' with Junk E-mail folder
MESSAGEPROPS mp.cbSize=sizeof(mp)
f.GetFirstMessage(0 0 MESSAGEID_FIRST &mp +&h)
CIntStack ist
ist.Initiate
i=0
if(!_hresult)
,rep
,,i=i+1
,,lp=mp.dwMessageId
;,,out "%i - %i" i lp
,,;; push it in array of messages id
,,ist.Push(lp)
,,f.GetNextMessage(+h 0 &mp)
,,if(_hresult) break
,f.GetMessageClose(+h)
nMess=i
if N > nMess or N<0
,_s.format("Job aborted, Illegal ''N'' value : %i, Range : 0 to %i" N nMess)
,min 0; err out "<>%s : <open ''%s /%i''>%s</open> - %s" NowT si _error.place si _s
,mac "Warning_QM" si 0
,Task_Message _s 0 252 1
,end
lp=ist.out(nMess-N-1)
_s.format("Messages sent : Total= %i Current= %i Message Id=%i" nMess N lp)
min 0; err out "<>%s : <open ''%s /%i''>%s</open> - %s" NowT si _error.place si _s
OEMESSAGE& m=a[]
IStream is=0
f.OpenMessage(lp IID_IStream &is)
err
,_s=_error.description
,out "<>%s : <open ''%s /%i''>%s</open> - %s" NowT si _error.place si _s
,mac "Warning_QM" si
,end
m.source.all(mp.cbMessage 2)
int ms
is.Read(m.source m.source.len &ms)