Bon, j'ai eu un peu de temps pour regarder ça (après le match...

).
En fait, je me disais que le plus efficace serait encore de passer par Outlook directement.
Donc après quelques recherches, j'ai pu te pondre un petit truc qui j'espère fonctionnera avec Oulook 2007 :
► Afficher le texte_OutlookFindExchangeAccount
Code : Tout sélectionner
If _OutlookFindExchangeAccount() Then
MsgBox(0, "_OutlookFindExchangeAccount", "Il y a un compte Exchange configuré")
Else
MsgBox(48, "_OutlookFindExchangeAccount", "Aucun compte Exchange n'a été configuré")
EndIf
Func _OutlookFindExchangeAccount()
Local Const $olExchange = 0 ; An Exchange account.
Local $objOutlook = ObjCreate("Outlook.Application")
If NOT IsObj($objOutlook) Then Return SetError(1, 0, 0)
Local $oAccounts = $objOutlook.Session.Accounts
If NOT IsObj($objOutlook) Then Return SetError(2, 0, 0)
For $oAccount In $oAccounts
If $oAccount.AccountType = $olExchange Then Return 1
Next
Return 0
EndFunc
Du coup, je me suis dit que tant qu'à faire, on pouvait aussi retourner quelques infos supplémentaires :
► Afficher le texte_OutlookGetAccounts
Code : Tout sélectionner
#Include <Array.au3>
$aAccounts = _OutlookGetAccounts()
If IsArray($aAccounts) Then
MsgBox(0, "_OutlookGetAccounts", "Il y a " & $aAccounts[0][0] & " compte(s) configuré(s)")
_ArrayDisplay($aAccounts)
EndIf
Func _OutlookGetAccounts()
Local $aResult[1][2] = [[0]]
Local Const $olEas = 4 ; An account that uses Exchange ActiveSync (EAS) on mobile devices.
Local Const $olExchange = 0 ; An Exchange account.
Local Const $olHttp = 3 ; An HTTP account.
Local Const $olImap = 1 ; An IMAP account.
Local Const $olOtherAccount = 5 ; Other or unknown account.
Local Const $olPop3 = 2 ; A POP3 account.
Local $objOutlook = ObjCreate("Outlook.Application")
If NOT IsObj($objOutlook) Then Return SetError(1, 0, 0)
Local $oAccounts = $objOutlook.Session.Accounts
If NOT IsObj($objOutlook) Then Return SetError(2, 0, 0)
For $oAccount In $oAccounts
Redim $aResult [ UBound($aResult) + 1][2]
$aResult[0][0] += 1
Switch $oAccount.AccountType
Case $olEas
$aResult[UBound($aResult) - 1][0] = "ActiveSync"
Case $olExchange
$aResult[UBound($aResult) - 1][0] = "Exchange"
Case $olHttp
$aResult[UBound($aResult) - 1][0] = "HTTP"
Case $olImap
$aResult[UBound($aResult) - 1][0] = "IMAP"
Case $olOtherAccount
$aResult[UBound($aResult) - 1][0] = "Unknow"
Case $olPop3
$aResult[UBound($aResult) - 1][0] = "Pop3"
EndSwitch
$aResult[UBound($aResult) - 1][1] = $oAccount.DisplayName
Next
Return $aResult
EndFunc
Cette fonction te retourne un tableau contenant la liste des comptes :
- $array[0][0] : Nombre de comptes
- $array[x][0] : Type de compte
- $array[x][1] : Nom du compte
....
Le script, ça fait gagner beaucoup de temps... à condition d'en avoir beaucoup devant soi !