PDA

View Full Version : searchfolders in exchange oulook vba



kriszty
09-05-2011, 06:30 AM
i made a autohotkey program for looking in a searchfolder in Outlook, this application works in normal outlook 2007, but in exchange still not. I know it,s a autohotkey program, but it uses the same VBA code.
So any help would be welcome.

the problem exist in the line,
colStores := ComObjActive("Outlook.Application").Session.stores
and the line getsearchfolders , it have to work in exchange outlook

here is the autohotkey code:

esc::ExitApp
F12::


ifwinNotactive, test - microsoft outlook
{
msgbox,,Vestia Delft,Onjuiste Folder ga naar juiste folder en start opnieuw F12
exit
}

colStores := ComObjActive("Outlook.Application").Session.stores

Loop, % colStores.count {
oSearchFolders := colStores.item(A_Index).GetSearchFolders

Loop, % oSearchFolders.count {

}}

if osearchfolders.item("test")
{
msgbox,,Vestia Delft,Mailbox Facturen aanwezig Geef enter voor Actie uitvoeren Wocas

}

DraftItems := oSearchFolders.item("test").Items

Loop, % DraftItems.Count

{
Item := DraftItems.item(A_Index)
item2 := draftitems.item(1)

if item2.unread
{
msgbox,,Vestia Delft,Eerste factuur via Wocas4all actie uitvoeren
exit
}


if item.unread
{
sleep 300
send ^q ; hier komt de diskis sneltoetsen
sleep 1400
getal := A_index
gosub start1
}
}
return


start1:


DraftItems := oSearchFolders.item("test").Items
Loop, % DraftItems.Count

{
Item := DraftItems.item(getal)

if item.unread
{

gosub fout
}

else
{
sleep 800
send {DOWN}
return
}
}
return

fout:

DraftItems := oSearchFolders.item("test").Items

Loop, % DraftItems.Count

{
Item := DraftItems.item(A_Index)




if item.unread
{
sleep 300
send ^q ; hier komt de diskis sneltoetsen
sleep 1400
getal := A_index
gosub start1
}
}
return