if USE_OUTLOOKINTERFACE and iscomobject('VFPCOM.COMUTIL') and iscomobject('outlook.application') > this.oVFPCOM = create('VFPCOM.COMUTIL') > this.oOutlook = createobject('outlook.application') > this.oOutlookEventHandler = createobject('OutlookApplicationEvents') > > local lcError > lcError = this.oVFPCOM.BindEvents(this.oOutlook, this.oOutlookEventHandler) > > if empty(lcError) > this.lUseOutlookInterface = .t. > else > this.lUseOutlookInterface = .f. > endif > >else > > this.lUseOutlookInterface = .f. >endif>
with this > > local loMessage > > loMessage = .oOutlook.createitem(olMailItem) > > loMessage.UserProperties.Add('ToContactID', olNumber) > loMessage.UserProperties.Add('FromRep', olText) > loMessage.UserProperties('ToContactID') = this.GetCurrentContact() > loMessage.UserProperties('FromRep') = this.cInitials > > loMessage.Recipients.Add(contactview.email) > loMessage.Recipients.ResolveAll() > loMessage.Display(.f.) > >endwith>
DEFINE CLASS OutlookApplicationEvents AS custom > >PROCEDURE ItemSend(Item,Cancel) > >* got as far as here once (and then didn't C5!) >if version(2) > 0 > set step on >endif > >* if the item is a mail item and it has custom properties ToContactID and FromRep, make a note of its contents in the contact log >if vartype(Item.UserProperties('ToContactID')) = 'N' and vartype(Item.UserProperties('FromRep')) = 'C' > > local lcAttachments > lcAttachments = '' > for i = 1 to Item.Attachments.Count > lcAttachments = lcAttachments + CR + Item.Attachments(i).DisplayName > endfor > > goApp.MakeNote( ; > 'E', ; > Item.UserProperties('ToContactID'), ; > 'Subject: ' + item.Subject + CR + 'To: ' + item.To + CR + '----' + CR + item.Body + CR + '-Attachments--' + lcAttachments, ; > .t., ; > .f., ; > .f., ; > .f., ; > .t. ; > ) >endif > >ENDPROC > >[snipped the remaining code (defaults only)]>