water Posted December 19, 2011 Author Share Posted December 19, 2011 Hi John,should be possible using the OutlookEX UDF. Use_OL_FolderAccess to access the contacts folder_OL_ItemFind to get the contacts (select EntryID plus all the properties you want to change)_OL_ItemModify to update the contacts using the EntryIDI will be glad to help if you have further questionsWater 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...
storme Posted December 20, 2011 Share Posted December 20, 2011 Hi John, should be possible using the OutlookEX UDF. Use_OL_FolderAccess to access the contacts folder_OL_ItemFind to get the contacts (select EntryID plus all the properties you want to change)_OL_ItemModify to update the contacts using the EntryIDI will be glad to help if you have further questions Water I Must be missing something. It looks so easy. I threw this code together from the examples but I've got something out of place as i get and error 3. #include <OutlookEX.au3> Global $oOutlook = _OL_Open() global $aFolder = _OL_FolderAccess($oOutlook, "", $olFolderContacts) If @error <> 0 Then Exit MsgBox(16, "OutlookEX UDF: _OL_FolderAccess Example Script", "Error accessing the default contacts folder. @error = " & @error) $aFolder[1].Display ;MsgBox(64, "OutlookEX UDF: _OL_FolderAccess Example Script", "Default contacts folder successfully accessed and displayed.") Global $aItems = _OL_ItemFind($oOutlook, $aFolder[1], "", "", "", "", "All") If @error = 0 Then MsgBox(64, "OutlookEX UDF: _OL_ItemFind Example Script", "Number of items found: " & $aItems) Else MsgBox(48, "OutlookEX UDF: _OL_ItemFind Example Script", "Could not find an item in the contacts folders. @error = " & @error & ", @extended: " & @extended) EndIf _ArrayDisplay($aItems) The contacts are displayed so the "FolderAccess" is OK. and $aFolder[1] should be the folder object that "ItemFind" asks for. So what am I missing??? I did try specifying the folder directly and using $aFolder[5] but nothing gave me any joy. Help would be apreciated. Thanks John Morrison Some of my small contributions to AutoIt Browse for Folder Dialog - Automation SysTreeView32 | FileHippo Download and/or retrieve program information | Get installedpath from uninstall key in registry | RoboCopy function John Morrison aka Storm-E Link to comment Share on other sites More sharing options...
water Posted December 20, 2011 Author Share Posted December 20, 2011 You did everything quite well. The problem is the "All" parameter. It isn't implemented properly yet Replace "All" with "EntryId,xxx,yyy" where xxx and yyy are any of the ContactItem properties which you can find here.Plus replace lineMsgBox(64, "OutlookEX UDF: _OL_ItemFind Example Script", "Number of items found: " & $aItems)withMsgBox(64, "OutlookEX UDF: _OL_ItemFind Example Script", "Number of items found: " & $aItems[0][0]) 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...
Sath Posted January 10, 2012 Share Posted January 10, 2012 Hi Water, Been trying to find a way to see items in the To-do list. Is there a way in the OutlookEx to access the contents of the to-do list or is it only possible to access actual Tasks? Many Thanks Sath Link to comment Share on other sites More sharing options...
water Posted January 10, 2012 Author Share Posted January 10, 2012 Which version of Outlook do 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...
Sath Posted January 11, 2012 Share Posted January 11, 2012 Sorry missed that off, Am using 2007. Thanks Link to comment Share on other sites More sharing options...
water Posted January 11, 2012 Author Share Posted January 11, 2012 Haven't done it myself but I think this should work: #include <OutlookEX.au3> $oOL = _OL_Open() $aFolder = _OL_FolderAccess($oOL, "", $olFolderToDo) Then you can search the folder for whatever you like. 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...
wokao98 Posted January 15, 2012 Share Posted January 15, 2012 hi water i think the Func _OL_ItemForward($oOL, $oOL_Item, $sOL_StoreID, $iOL_Type) $oOL_Item.Forward may be change $oOL_Item=$oOL_Item.Forward Link to comment Share on other sites More sharing options...
water Posted January 15, 2012 Author Share Posted January 15, 2012 Thanks, will be corrected and added to the bug report on page 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...
Tjalve Posted February 1, 2012 Share Posted February 1, 2012 (edited) *remove this post* Edited February 1, 2012 by Tjalve Link to comment Share on other sites More sharing options...
Tjalve Posted February 1, 2012 Share Posted February 1, 2012 Hi there. Im new to the forum and new to autoit. have been playing around with for a few wekks and im starting to get the hang of it. Im currently developing an "archiving" script for the compy I work for. It works good but i cant really get the outlook export-part to work just as i want it. Btw water your UDF is awsome! I just ned a little help. My idee is to create a PST file and dump all the users folders in that PST file (including calender contacs and so on) and then archive this PST file on a local server. First of all, im no programmer and i dont have that mutch knowlege of how Exchange and outlook works. I made this simpel code: $outlook = _OL_Open() $array1 = _OL_FolderTree($outlook,"*") $PST = _OL_PSTCreate($outlook,@DesktopDir & "\" & @YEAR & "-" & @MON & "-" & @MDAY & "-" & @username & ".pst",@YEAR & "-" & @MON & "-" & @MDAY & "-" & @username) For $i = 1 to UBound($array1)-1 Step 1 _OL_FolderCopy($outlook, "*\" & $array1[$i], $PST) Next _OL_PSTClose($outlook,$PST) _OL_Close($outlook) However it wasnt that simple. I figured out that if i modified $array1[$i] to remove the mailbox name, it works. But the problem then is foldercopy copies all subfolders aswell. So if i have a cople of subfilders, i will get severel folders with the same content. I olso tried stuff like: _OL_FolderCopy($outlook, "name of the mailbox\inbox", "\\name of PST\Inbox") but it doesnt work. I think it has to to with the folders beeing Items and given e specific ID or somthing. But i just cant figure it out. And the examples isnt giving me any real examples. I just want to copy ALL the folders for the primary mailbox to an PST file. Is it duable? Thansk guys Btw. Great forum! Link to comment Share on other sites More sharing options...
water Posted February 1, 2012 Author Share Posted February 1, 2012 Outlook has an Auto-Archive feature. You can specify on a per folder basic when elements of the folder should be copied/moved to a PST. Maybe this makes archiving a bit easier? Right-click a folder, click on Properties and then on Auto-Archiving (translated from german on the fly ,-) 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...
Tjalve Posted February 1, 2012 Share Posted February 1, 2012 No im making an archiving script for people who are leaving our company When a user quit we want to make a dump of the users mailbox (amung other things) and store them ona server for arhcing purposes. Then we can remove the mailbox and reuse the computer for another employee. So no. Auro archiving is not want i want. Im making a program that will eleminate all the manual work that needs to be done when a person quit. i have all my elemets in place, except for a backup of the users enire mailbox. And since we lease our mailboxes (we dont have the exchangeserver in house) i need to make a PST dump from outlook. Link to comment Share on other sites More sharing options...
water Posted February 1, 2012 Author Share Posted February 1, 2012 As _OL_FolderCopy copies a folder, all subfolders and all contained items you only need to specify the root folder. This works for me to copy the inbox to a pst. Repeat the _OL_FolderCopy for any foldertype you like. #include <OutlookEx.au3> #include <array.au3> $iOL_Debug = 2 $oOutlook = _OL_Open() ConsoleWrite("OO: " & @error & "-" & @extended & @CRLF) $oPST = _OL_PSTCreate($oOutlook, "C:\temp" & "\" & @YEAR & "-" & @MON & "-" & @MDAY & "-" & @UserName & ".pst", @YEAR & "-" & @MON & "-" & @MDAY & "-" & @UserName) ConsoleWrite("PC: " & @error & "-" & @extended & @CRLF) #cs Global Const $olFolderCalendar = 9 ; Calendar folder Global Const $olFolderContacts = 10 ; The Contacts folder Global Const $olFolderDeletedItems = 3 ; The Deleted Items folder Global Const $olFolderDrafts = 16 ; The Drafts folder Global Const $olFolderInbox = 6 ; The Inbox folder Global Const $olFolderJournal = 11 ; The Journal folder Global Const $olFolderJunk = 23 ; The Junk E-Mail folder Global Const $olFolderNotes = 12 ; The Notes folder Global Const $olFolderOutbox = 4 ; The Outbox folder Global Const $olFolderSentMail = 5 ; The Sent Mail folder Global Const $olFolderTasks = 13 ; The Tasks folder Global Const $olFolderToDo = 28 ; The To Do folder Global Const $olFolderRssFeeds = 25 ; The RSS Feeds folder #ce $aFolder = _OL_FolderAccess($oOutlook, "" , $olFolderInbox) ConsoleWrite("FA: " & @error & "-" & @extended & @CRLF) _OL_FolderCopy($oOutlook, $aFolder[1], $oPST) ConsoleWrite("FC: " & @error & "-" & @extended & @CRLF) _OL_PSTClose($oOutlook, $oPST) ConsoleWrite("PC: " & @error & "-" & @extended & @CRLF) _OL_Close($oOutlook) ConsoleWrite("OC: " & @error & "-" & @extended & @CRLF) As a result you get on the console something like: OO: 0-1 PC: 0-0 FA: 0-0 FC: 0-0 PC: 0-0 OC: 0-0 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...
Tjalve Posted February 1, 2012 Share Posted February 1, 2012 Ok so i cant copy "root" to "root"? There might be folders in the root (other then inbox) that i want to copy. And i need to specify and call the _OL_FolderCopy for every folder in root? Thanx Link to comment Share on other sites More sharing options...
water Posted February 1, 2012 Author Share Posted February 1, 2012 (edited) This code will take all "root" folders (level 1 of the folder hierarchy) and copy it to a PST. The code writes the name of each root folder plus error codes for folder access and folder copy to the console. Later you can remove the ConsoleWrite statements but you have to replace them with some real error checking. That is: Write a MsgBox and exit the script if an error occurres. #include <OutlookEx.au3> #include <array.au3> $iOL_Debug = 2 $oOutlook = _OL_Open() ConsoleWrite("OO: " & @error & "-" & @extended & @CRLF) $oPST = _OL_PSTCreate($oOutlook, "C:temp" & "" & @YEAR & "-" & @MON & "-" & @MDAY & "-" & @UserName & ".pst", @YEAR & "-" & @MON & "-" & @MDAY & "-" & @UserName) ConsoleWrite("PC: " & @error & "-" & @extended & @CRLF) $aFolders = _OL_FolderTree($oOutlook, "*") _ArrayDisplay($aFolders) Global $sPreviousFolder = "" Global $iRoot = StringLen($aFolders[0]) For $i = 1 To UBound($aFolders)-1 $aTemp = StringSplit(StringMid($aFolders[$i], $iRoot+2), "") If $aTemp[1] <> $sPreviousFolder Then ConsoleWrite($aTemp[1] & @CRLF) $sPreviousFolder = $aTemp[1] $aFolder = _OL_FolderAccess($oOutlook, "*" & $aTemp[1]) ConsoleWrite("FA: " & @error & "-" & @extended & @CRLF) _OL_FolderCopy($oOutlook, $aFolder[1], $oPST) ConsoleWrite("FC: " & @error & "-" & @extended & @CRLF) Endif Next _OL_PSTClose($oOutlook, $oPST) ConsoleWrite("PC: " & @error & "-" & @extended & @CRLF) _OL_Close($oOutlook) ConsoleWrite("OC: " & @error & "-" & @extended & @CRLF) Edited February 1, 2012 by water 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...
Tjalve Posted February 1, 2012 Share Posted February 1, 2012 Alright. Thank you so mutch I will study you code in detail and try to learn and better understand how this works. Thanx again. Link to comment Share on other sites More sharing options...
water Posted February 1, 2012 Author Share Posted February 1, 2012 In short: It gets a list of all folders (including subfolders). In element 0 of the array we have the name of the store. This name is stripped of every folder. The remaining is then split at the separator character "". If the first element of the result changes a new "root" folder is to be processed. It is accessed and then copied to the PST. 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...
Tjalve Posted February 1, 2012 Share Posted February 1, 2012 Funny thin is that i almost wrote the same code. The diffrence was that i didnt do the folder access in the end. I tried to enter the "path" to the folder directly into _OL-Foldercopy instead of using _OL-FolderAcess [1] array. Thanx water. Now the script seems to work. I will see if i can get it to count all items and disply some sort of progress bar aswell Link to comment Share on other sites More sharing options...
water Posted February 1, 2012 Author Share Posted February 1, 2012 Counting items needs some work because you only can access the item count of a single folder. To get the item count for any subfolders you have to loop through the hierarchy. 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