djfistic Posted August 3, 2017 Share Posted August 3, 2017 (edited) Dear all, I would like to get all Outlook's contacts with the fields (EmailAdddress,name and (alias) sn, in one Exchange AdressList selected. I'm with Outlook 2016 with an Exchange account. I have no rights on AD servers, I'm a simple user. For the moment I can get all accounts with the "outlook udf" , but the "sn" propertie is not included. I'm a bit stuck. After several tries, I don't have any ideas to get it ?? I can see no options in the udf. Do you have any ideas ? Test.au3 Edited August 3, 2017 by djfistic Link to comment Share on other sites More sharing options...
water Posted August 3, 2017 Share Posted August 3, 2017 Did you try the new OutlookEX UDF? Link is in my signature. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
djfistic Posted August 3, 2017 Author Share Posted August 3, 2017 Hello water, Thank you for your answer,I updated the udf, but it the same. Is there some possibilities with the udf to get properties such postal code, country of an user ? if yes, the alias propertie is maybe in the same place. Link to comment Share on other sites More sharing options...
water Posted August 3, 2017 Share Posted August 3, 2017 Can you please post the script you use? My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
djfistic Posted August 3, 2017 Author Share Posted August 3, 2017 #include <OutlookEX.au3> ; ***************************************************************************** ; Open Outlook instance ; ***************************************************************************** Global $oOutlook = _OL_Open() If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF", "Error creating a connection to Outlook. @error = " & @error & ", @extended = " & @extended) ; List all adress lists ; ***************************************************************************** $aResult = _OL_AddressListGet($oOutlook, False) If @error <> 0 Then _ Exit MsgBox(16, "OutlookEX UDF: _OL_AddressListGet Example Script", "Error " & @error & " when listing all address lists!") _ArrayDisplay($aResult, "OutlookEX UDF: _OL_AddressListGet Example Script - All address lists", "", 0, "|", "OlAddressListType|Name|Index|Resolving order|Identifier") ; Keep list who contains the word Local $sSearchList="SAS" If IsArray($aResult) Then Local $index=_ArraySearch($aResult, $sSearchList, 0, 0, 0, 1, 0) If @error Then MsgBox($MB_SYSTEMMODAL, "Not Found",$sSearchList & " was not found") Else MsgBox($MB_SYSTEMMODAL, "Found", $sSearchList & "was found in the array at position " & $index ) ; Get all List members with my var $sSearchList filter $aResult = _OL_AddressListMemberGet($oOutlook, $aResult[$index][1]) If @error <> 0 Then _ Exit MsgBox(16, "OutlookEX UDF: _OL_AddressListMemberGet Example Script", "Error " & @error & " gettings members of first address lists!") _ArrayDisplay($aResult, "OutlookEX UDF: _OL_AddressListMemberGet Example Script - All members of the first address list", "", 0, "|", "EMail address|Name|OlAddresEntryUserType|Identifier|Object of the address entry") EndIf EndIf _OL_Close($oOutlook) Here is my actual code. Link to comment Share on other sites More sharing options...
water Posted August 10, 2017 Share Posted August 10, 2017 Element 4 of each array row contains the contact object. The possible properties you can retrieve can be found here: https://msdn.microsoft.com/de-de/library/ff867603.aspx Example: $aResult[1][4].LastName returns the lastname of the first contact. djfistic 1 My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
djfistic Posted August 11, 2017 Author Share Posted August 11, 2017 Dear water, Thanks to you, it works fine now. Thanks a lot For get the Alias property, you must set the variable to .Alias $aResult[1][4].Alias See bellow the final code who works . expandcollapse popup#include <OutlookEX.au3> #include <Array.au3> ; ***************************************************************************** ; Open Outlook instance ; ***************************************************************************** Global $oOutlook = _OL_Open() If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF", "Error creating a connection to Outlook. @error = " & @error & ", @extended = " & @extended) ; List all address lists ; ***************************************************************************** $aResult = _OL_AddressListGet($oOutlook, False) If @error <> 0 Then _ Exit MsgBox(16, "OutlookEX UDF: _OL_AddressListGet Example Script", "Error " & @error & " when listing all address lists!") _ArrayDisplay($aResult, "OutlookEX UDF: _OL_AddressListGet Example Script - All address lists", "", 0, "|", "OlAddressListType|Name|Index|Resolving order|Identifier") ; Keep list who contains the word Local $sSearchList="SAS" ; Set an array for all aliases Local $aAliases[0] If IsArray($aResult) Then Local $index=_ArraySearch($aResult, $sSearchList, 0, 0, 0, 1, 0) If @error Then MsgBox($MB_SYSTEMMODAL, "Not Found","List who contain the word : "& $sSearchList & " was not found in all address list !") Else MsgBox($MB_SYSTEMMODAL, "Found","List who contain the word : "& $sSearchList & " was found in the array at position " & $index ) ; Get all List members with my var $sSearchList $aResult = _OL_AddressListMemberGet($oOutlook, $aResult[$index][1]) If @error <> 0 Then _ Exit MsgBox(16, "OutlookEX UDF: _OL_AddressListMemberGet Example Script", "Error " & @error & " gettings members of first address lists!") _ArrayDisplay($aResult, "OutlookEX UDF: _OL_AddressListMemberGet Example Script - All members of the first address list", "", 0, "|", "EMail address|Name|OlAddresEntryUserType|Identifier|Object of the address entry") For $cpt=1 To UBound($aResult)-1 Local $sCurrentALias=$aResult[$cpt][4].Alias ConsoleWrite("Current alias : " &$sCurrentALias &@CRLF) If $sCurrentALias<>"" Then _ArrayAdd($aAliases,$sCurrentALias) Next If UBound($aAliases) > 0 Then _ArrayDisplay($aAliases,"All aliases") EndIf EndIf _OL_Close($oOutlook) Link to comment Share on other sites More sharing options...
water Posted August 11, 2017 Share Posted August 11, 2017 Glad you got it working My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now