MCv Posted July 17, 2019 Author Share Posted July 17, 2019 1 hour ago, water said: Can you please post a screenshot of Outlook after you have manually connected to the other mailbox (all private info can be greyed out)? I will do that first thing tomorrow (I'm not at work right now). Link to comment Share on other sites More sharing options...
MCv Posted July 18, 2019 Author Share Posted July 18, 2019 Here's a screenshot of the Outlook window that opens after running the script Link to comment Share on other sites More sharing options...
water Posted July 18, 2019 Share Posted July 18, 2019 I'm not in my office at the moment, so we will do some guesswork now: The Mailbox name above the Inbox folder is your Mailbox, correct? I would like to see the format of the other Mailbox when you manually had added it to Outlook. Please anonymize by replacing personal data with a general description (e.g. "George.Lukas@Microsoft.com - Mailbox" will become "Firstname.Lastname@Company.com - Mailbox". Maybe the folder few returns better results. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
MCv Posted July 18, 2019 Author Share Posted July 18, 2019 Here's a new screenshot of the Outlook window that opens after running the script, now with the account names in it. MY,name@company.com is the default account, so you can see the correct account is now selected (bla@company.com), but instead of the Inbox some sort of Search is displayed. Note that the Inbox of bla@company.com is not empty. I hope this is what you're asking for? Link to comment Share on other sites More sharing options...
water Posted July 18, 2019 Share Posted July 18, 2019 This seems to be a public folder so one of the following should work: $aFolder = _OL_FolderAccess($oOutlook, "bla@company.com", $olFolderInbox) ; This format is language independant or $aFolder = _OL_FolderAccess($oOutlook, "bla@company.com\Inbox") ; "Inbox" is language dependant My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
MCv Posted July 18, 2019 Author Share Posted July 18, 2019 17 minutes ago, water said: This seems to be a public folder so one of the following should work: $aFolder = _OL_FolderAccess($oOutlook, "bla@company.com", $olFolderInbox) ; This format is language independant or $aFolder = _OL_FolderAccess($oOutlook, "bla@company.com\Inbox") ; "Inbox" is language dependant Hi, tried both options, plus localizing the last one for Dutch: all give error 4. Inbox is 'Postvak IN' in Dutch. No idea if it doesn't work because it's 2 words instead of the 1 word Inbox. Tried \\bla@company.com\Inbox and \\bla@company.com\Postvak IN for good measure: error 1. BUT: referencing again by name and localizing does the trick! So this results in displaying the Inbox folder (for a Dutch account ) $aFolder = _OL_FolderAccess($oOutlook, "ACCOUNT NAME\Postvak IN") Now I'll try to take it again from here. Thank you for your help! Link to comment Share on other sites More sharing options...
water Posted July 18, 2019 Share Posted July 18, 2019 2 minutes ago, MCv said: Tried \\bla@company.com\Inbox and \\bla@company.com\Postvak IN for good measure: error 1. Thats fine because the "\\" format is not valid for public folders. I will check if spaces in the folder name make a difference My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
MCv Posted July 18, 2019 Author Share Posted July 18, 2019 6 hours ago, water said: Thats fine because the "\\" format is not valid for public folders. I will check if spaces in the folder name make a difference I don't think they are public folders (you need permission to access them, obviously I have permission). Anyway, it seems to work now, using the account name instead of the email address (and localizing in my case). Hopefully this will be useful for other people. Link to comment Share on other sites More sharing options...
water Posted July 18, 2019 Share Posted July 18, 2019 "Public folder" does not mean that everyone has full access to this folder. I understand that there are "personal folders" assigned to an individual and "public folders" with a general scope like "info@company.com" or "invoice@company.com" or "application@company.com". My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
nooneclose Posted July 19, 2019 Share Posted July 19, 2019 (edited) I agree with @water. HIs code (shown below) worked for me when trying to access a different email that I had permission to access. (the email wasn't public but I was given access/permission to it) $aFolder = _OL_FolderAccess($oOutlook, "bla@company.com", $olFolderInbox) ; This format is language independant I also used this code to test it further and it did exactly what I was hoping for. the code showed me all unread emails with that certain subject from the other email's inbox: Global $aItems = _OL_ItemFind($oOutlook, "*", $olMail, _ "[UnRead]=True", "Subject", "Work Request", "EntryID,Subject", "", 1) ; Display the array of unRead emails _ArrayDisplay($aItems, "OutlookEX UDF: _OL_ItemFind - Unread mails") Global $numberOfUnRead = UBound($aItems, $UBOUND_ROWS) - 1 ConsoleWrite("Number of unread emails: " & $numberOfUnRead & @CRLF) Edited July 19, 2019 by nooneclose Link to comment Share on other sites More sharing options...
MCv Posted July 21, 2019 Author Share Posted July 21, 2019 On 7/19/2019 at 7:40 PM, nooneclose said: I agree with @water. HIs code (shown below) worked for me when trying to access a different email that I had permission to access. (the email wasn't public but I was given access/permission to it) Well, it doesn't work for me, but using the account name instead of the email address does work for me, So the problem is solved, albeit in a different way than yours Now on to the next problem: I can find the unread emails with .zip attachments just fine, but saving them isn't working... grrr Link to comment Share on other sites More sharing options...
water Posted July 21, 2019 Share Posted July 21, 2019 Please define: "Isn't working". How do you save the attachments and what is the value of @error and @extended after this function? My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
MCv Posted July 22, 2019 Author Share Posted July 22, 2019 13 hours ago, water said: Please define: "Isn't working". How do you save the attachments and what is the value of @error and @extended after this function? Sorry, you're absolutely correct. Here is the core of the code: $oOutlook = _OL_Open() $aFolder = _OL_FolderAccess($oOutlook, $test_outlook_mailbox_stuursignaal) $aResult = _OL_Itemfind($oOutlook, $aFolder[1], $olMail, "", "Subject", "Report (P)", "EntryID") If IsArray($aResult) Then For $i = 1 To $aResult[0][0] $aAttachments = _OL_ItemAttachmentGet($oOutlook, $aResult[$i][0]) _Arraydisplay($aAttachments, "Test") If IsArray($aAttachments) Then For $j = 1 To $aAttachments[0][0] MsgBox(48, "", "@error = " & @error & ", @extended: " & @extended) _OL_ItemAttachmentSave($oOutlook, $aResult[$i][0], $aFolder, $j, "C:\M\" & $aAttachments[$j][1]) MsgBox(48, "", "@error = " & @error & ", @extended: " & @extended) Next EndIf Next Endif The arraydisplay gives the array: (row 0, col 0) 1 (=correct, 1 email with the attachment with the right subject) (row 1, col 1) name of the attachment, a .zip file (row 1, col 2) same as row 1, col 1 The first messagebox gives error 0, the second messagebox (after the itemattachmentsave) gives error 3. Link to comment Share on other sites More sharing options...
water Posted July 22, 2019 Share Posted July 22, 2019 @error = 3 stands for: Specified item could not be found You aren't setting parameter $sStoreID in the correct way: Should be something like: _OL_ItemAttachmentSave($oOutlook, $aResult[$i][0], Default, $j, C":\M\" & $aAttachments[$j][1]) My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
MCv Posted July 22, 2019 Author Share Posted July 22, 2019 6 minutes ago, water said: @error = 3 stands for: Specified item could not be found You aren't setting parameter $sStoreID in the correct way: Should be something like: _OL_ItemAttachmentSave($oOutlook, $aResult[$i][0], Default, $j, C":\M\" & $aAttachments[$j][1]) Okay, but I don't want to use the Default user's mailbox, I want to use another mailbox (see discussion above). AFAIK: $sStoreID StoreID of the source store as returned by _OL_FolderAccess. Use the keyword "Default" to use the users mailbox This is the reason I'm using $aFolder as $sStoreID. Or am I totally wrong? Link to comment Share on other sites More sharing options...
water Posted July 22, 2019 Share Posted July 22, 2019 To access the mailbox (store) of another user you have to specify the StoreID. As _OL_FolderAccess returns an array you have to specifiy the array element. _OL_ItemAttachmentSave($oOutlook, $aResult[$i][0], $aFolder[3], $j, "C:\M\" & $aAttachments[$j][1]) My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
MCv Posted July 22, 2019 Author Share Posted July 22, 2019 1 hour ago, water said: To access the mailbox (store) of another user you have to specify the StoreID. As _OL_FolderAccess returns an array you have to specifiy the array element. _OL_ItemAttachmentSave($oOutlook, $aResult[$i][0], $aFolder[3], $j, "C:\M\" & $aAttachments[$j][1]) Yep, that does the trick! Thanks :)) Link to comment Share on other sites More sharing options...
water Posted July 22, 2019 Share Posted July 22, 2019 Glad the problem could be solved BTW: There is no need to quote everything I posted - I know what I posted Simply add your post at the end of the thread. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
MCv Posted July 22, 2019 Author Share Posted July 22, 2019 Okay, will do 👍 Thanks again. 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