Outlook

Outlook

Postby Colin Haig » Sat Mar 13, 2010 3:33 am

Hi All

This code opens the inbox folder
oOL := TOleAuto():New( "Outlook.Application" )
oNameSpace := oOL:Get( "GetNameSpace", "MAPI" )
oInbox := oNameSpace:Get( "GetDefaultFolder",6) // 6 = Inbox-Folder

Is there a way to open a non default folder.

Cheers

Colin
Colin Haig
 
Posts: 310
Joined: Mon Oct 10, 2005 5:10 am

Re: Outlook

Postby anserkk » Sat Mar 13, 2010 5:51 am

Dear Mr.Colin,

Code: Select all  Expand view
#DEFINE olFolderCalendar 9
#DEFINE olFolderContacts 10
#DEFINE olFolderDeletedItems 3
#DEFINE olFolderInBox 6
#DEFINE olFolderJournal 11
#DEFINE olFolderNotes 12
#DEFINE olFolderOutBox 4
#DEFINE olFolderSentMail 5
#DEFINE olFolderTask 13


Display Outlook's calendar
Code: Select all  Expand view
LOCAL oOutlook,oNameSpace,oDefaultFolder
oOutlook:= CREATEOBJECT('outlook.application')
oNameSpace:= oOutlook:getnamespace('MAPI')
oDefaultFolder:=oNameSpace:GetDefaultFolder(olFolderCalendar) // Calendar
oDefaultFolder:display()
 


Adding a folder in Outlook
Code: Select all  Expand view
Local oOutlook,oNameSpace,oNewFolder
oOutlook:=CREATEOBJECT('outlook.application')
oNameSpaceL=oOutlook:GetNamespace('mapi')
oNewFolder:=oNameSpace:Folders[2]:Folders:Add('myNewFolder')  // This will create a folder in the Personal folders' directory of Outlook.


How to find the names of the folders within the inbox folder
Code: Select all  Expand view

#DEFINE olFolderInBox 6
Local oOutlook,oNameSpace,oDefaultFolder
oOutlook:=CREATEOBJECT('outlook.application')
oNameSpace:=oOutlook:GetNamespace('mapi')
oDefaultFolder:=oNameSpace:Getdefaultfolder(olFolderInBox)
oFolders:=oDefaultFolder:folders
FOR EACH oFolder IN oFolders
 ?oFolder:name
ENDFOR


Regads
Anser
User avatar
anserkk
 
Posts: 1332
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

Re: Outlook

Postby Colin Haig » Sun Mar 14, 2010 4:37 am

Hi Anser

Thanks for your suggestions - I got around the issue by making a sub folder of the inbox - and
then checking the messages in the sub folder

oOL := TOleAuto():New( "Outlook.Application" )
oNameSpace := oOL:Get( "GetNameSpace", "MAPI" )
oInbox := oNameSpace:Get( "GetDefaultFolder",6) // 6 = Inbox-Folder
oCMSFolder := oInbox:Folders("cmsmail")

for each oItem In oCMSFolder:Items
cSender := ''
cSubject := ''
cAttach := ''
cSender := oItem:sendername
cSubject := oItem:subject
for each oAttach In oItem:Attachments
cAttach := oAttach:filename
next
aadd(aData,left(alltrim(cSender) + space(35),35) + '|' + ;
left(alltrim(cSubject) + space(35),35) + '|' + ;
left(alltrim(cAttach) + space(60),60))

next
SysRefresh()
aShow(aData,1,0,30,140,'Emails','Details')


Cheers

Colin
Colin Haig
 
Posts: 310
Joined: Mon Oct 10, 2005 5:10 am


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 86 guests