Wooltown Posted April 27, 2009 Author Share Posted April 27, 2009 Capel - I have no idea of why this is happening - Are you displaying the result with _ArrayDisplay()? CodeMaker - Can you explain more specific what you mean? Link to comment Share on other sites More sharing options...
codemaker Posted April 28, 2009 Share Posted April 28, 2009 CodeMaker - Can you explain more specific what you mean?I want to read a specific note from Outlook and save it back as the same note Link to comment Share on other sites More sharing options...
Wooltown Posted April 29, 2009 Author Share Posted April 29, 2009 You can use: _OutlookModifyNote or is it something else you wish to have. Link to comment Share on other sites More sharing options...
91firehawk Posted May 19, 2009 Share Posted May 19, 2009 this is great! thanks for posting. is there an ETA on "_OutlookCopyMail"? this would be very helpful in my current script. Link to comment Share on other sites More sharing options...
mko Posted May 21, 2009 Share Posted May 21, 2009 Hi Thank you for your great work !! Is it much work to implement a little funktion like _OutlookCountUnreadMail($oOutlook,$olFolderInbox) ? Because if you have a big Mailbox with many unread mails the whole funktion _OutlookGetMail($oOutlook,$olFolderInbox,False,"","","","","","",True,"",0) needs a lot of time (because of _OutlookFindMailInTree) if you only want to know if there are some new mail. I want to check the count of unread mails in the loginscript.... Regards Martin Link to comment Share on other sites More sharing options...
want2learn Posted May 21, 2009 Share Posted May 21, 2009 hey wooltown, This is gr8 !!!!! Now i can finally get my appointments from outlook and directly do my accounts... Do you accept netteller? Link to comment Share on other sites More sharing options...
Bam Posted May 22, 2009 Share Posted May 22, 2009 Geting an error and ran out of ideas and was unable to find it in a search.#include <Outlook.au3> #include <Array.au3> $oOutlook = _OutlookOpen() $A = _OutlookGetMail($oOutlook) _ArrayDisplay($A) ConsoleWrite($A)And when i run that, i get one of these.Outlook.au3 (514) : ==> Error in expression.:Local $oNamespace = $oOutlook.GetNamespace("MAPI")Local $oNamespace = ^ ERRORany ideas? Link to comment Share on other sites More sharing options...
mko Posted May 22, 2009 Share Posted May 22, 2009 (edited) Hi Bam -Are you shure your actual useraccount has an correct configured outlook profile ? -Did you answer the messagebox wich controls the access to the profile with yes ? -Is your Autoit Version 3.1.1 or higher -Check successfull open of the new Object: $oOutlook = _OutlookOpen() If $oOutlook <> 0 then $A = _OutlookGetMail($oOutlook) _ArrayDisplay($A) ConsoleWrite($A) EndIf If you want to check the error please have a look in Outlook.au3, go to the funktion _OutlookGetMail and read the remarks by the way you do not need to include Array.au3 its already inluded in outlook.au3 Edited May 22, 2009 by mko Link to comment Share on other sites More sharing options...
Bam Posted May 22, 2009 Share Posted May 22, 2009 (edited) Well I tried it on this computer first and I dont get that error but $A returns 0. The other computer has the default Outlook by xp so I went back to the computer that dosnt give the error. -Are you shure your actual useraccount has an correct configured outlook profile ? Yup I can send and recieve emails if thats what you mean. -Did you answer the messagebox wich controls the access to the profile with yes ? Not shure on this one, looked around in options and didn't find any thing. <Edit> Hey just found a push and recieve COM thingy *restart outlook* and what do you know it works ty </> (Using Outlook 2007) -Is your Autoit Version 3.1.1 or higher Both are 3.3.0.0 And I saw that Array.au3 was already inluded in outlook.au3 but i thought id just leave it. Edited May 22, 2009 by Bam Link to comment Share on other sites More sharing options...
Wooltown Posted June 8, 2009 Author Share Posted June 8, 2009 (edited) mko: I will check if it is easy to do this function _OutlookCountUnreadMail($oOutlook,$olFolderInbox) ? But I think the function will take some time to run if you have many mail. Done - And it is fast !!!!! I changed the _OutlookGetMail() function and added a parameter $fCountMailOnly, setting this to True will return a small array displaying the total number of items and the number of unread items. [0][0] - Total Number of items [0][1] - Number of unread items Edited June 8, 2009 by Wooltown Link to comment Share on other sites More sharing options...
IQ9003 Posted July 1, 2009 Share Posted July 1, 2009 Is it possible to read from another folder instead the defaultfolder from the default user? What what I mean is this:- Mailbox_userX => Inbox => AcceptedI did manage to read mail via this solution: http://www.autoitscript.com/forum/index.ph...mp;#entry701901 Link to comment Share on other sites More sharing options...
Wooltown Posted July 2, 2009 Author Share Posted July 2, 2009 Excerpt from Script:; Function Name: _OutlookGetMail(); Description: Get all email using Microsoft Outlook.; Syntax.........: _OutlookGetMail($oOutlook, $sFolder = $olFolderInbox, $fSubFolder = False, $sFrom = "", $sTo = "", $sCc = "", $sBCc = "", $sSubject = "", $iImportance = "", $fOnlyReturnUnread = False, $sWarningClick = "", $iSetStatus = 0, $fCountMailOnly = False); Parameter(s): $oOutlook - Outlook object opened by a preceding call to _OutlookOpen(); $sFolder - Optional: Folder, default = $olFolderInbox, add subfolders if wish to start search at a lower level, ex: $olFolderInbox & "\Archive"; If you wish to access the root, use "\", Sent Items, write "\Sent Items"Or was it some other way you want ? Link to comment Share on other sites More sharing options...
IQ9003 Posted July 3, 2009 Share Posted July 3, 2009 I'm having trouble to get to the lower level mailbox In the picture I uploaded you can see that (it's in Dutch, but you'll understand) that RLB is the default mailbox. I'm trying to read a subfolder from another Mailbox (Info==>Inbox==>Testfolder) Link to comment Share on other sites More sharing options...
Wooltown Posted July 3, 2009 Author Share Posted July 3, 2009 OK I understand, well I don't know really, maybe I have some time during next week and can have a look at it. Link to comment Share on other sites More sharing options...
Wooltown Posted July 6, 2009 Author Share Posted July 6, 2009 (edited) IQ9003, Here is a beta version, test if it works, I don't have the possibility to test to read another persons mailbox. I tested towards a pst-file, but there I can't locate the standard inbox. To access another mailbox, start with 2 \\, see the example file in the zip-fileOutlookBeta.zip Edited July 6, 2009 by Wooltown Link to comment Share on other sites More sharing options...
IQ9003 Posted July 7, 2009 Share Posted July 7, 2009 I've tried the code however I can't get it to work. I'm not sure what the problem is, but I beleive it's in the following piece of code. (Iv'e checked all variables until this piece, I don't know how to check the rest of the code) If $fOtherMailBox = True Then Local $oSession = $oOutlook.Session Local $oMailBox = $oSession.CreateRecipient($sOtherMailBox) $oMailBox.Resolve Local $oFolder = $oNamespace.GetSharedDefaultFolder($oMailBox,$olFolderInbox) Local $sFolderName = $oFolder.Parent For $idx = 1 To $sFolderName.Folders.Count If $sFolderName.Folders.Item($idx).Name = $sFolder Then $oFolder = $sFolderName.Folders.Item($idx) Next EndIf Link to comment Share on other sites More sharing options...
IQ9003 Posted July 8, 2009 Share Posted July 8, 2009 (edited) Hello, I've made some progress on my own script in which I've managed to move a mail form mailbox1 to mailbox2 (including the subfolders I asked about). With the code you made and some googl'ing I was able to construct the following code: expandcollapse popup$teller=SaveAndMove("Mailbox User1\Inbox","Mailbox User2\Inbox\test") msgbox(0,"Mail moved","I've moved " & $teller & " mail Items") Func SaveAndMove($Postbus_old, $Postbus_new) $oOApp = ObjCreate("Outlook.Application") $myNamespace =$oOApp.GetNamespace("MAPI") ; Original folder $myarrayold=StringSplit ( $Postbus_old, "\") $myOldFolder = $myNamespace.Folders($myarrayold[1]) For $i=2 to $myarrayold[0] $myOldFolder=$myOldFolder.Folders($myarrayold[$i]) next ; Folder to put the mail in $myarraynew=StringSplit ( $Postbus_new, "\") $myNewFolder = $myNamespace.Folders($myarraynew[1]) For $i=2 to $myarraynew[0] $myNewFolder=$myNewFolder.Folders($myarraynew[$i]) next $teller=0 ;Countback loop, this is because the mailitem index resets after each move For $a=$myOldFolder.Items.count to 1 Step -1 If $myOldFolder.Items($a).flagicon=3 then $teller=$teller+1 $iAttachCnt = $myOldFolder.Items($a).Attachments.Count If $iAttachCnt > 0 Then For $iAttachNum = 1 to $iAttachCnt $oTemp = $myOldFolder.Items($a).Attachments.Item($iAttachNum) $sFileName = $oTemp.FileName $oTemp = $myOldFolder.Items($a).Attachments.Item($iAttachNum) if stringinstr($sFileName,".pdf") > 0 then $oTemp.SaveAsFile ("c:\temp\" & $sFileName) endif Next EndIf ;Move mail after saving attachements $myoldfolder.Items($a).move ($myNewFolder) endif next return $teller endfunc Edited July 8, 2009 by IQ9003 Link to comment Share on other sites More sharing options...
Wooltown Posted July 8, 2009 Author Share Posted July 8, 2009 Hello, I've made some progress on my own script in which I've managed to move a mail form mailbox1 to mailbox2 (including the subfolders I asked about). With the code you made and some googl'ing I was able to construct the following code: expandcollapse popup$teller=SaveAndMove("Mailbox User1\Inbox","Mailbox User2\Inbox\test") msgbox(0,"Mail moved","I've moved " & $teller & " mail Items") Func SaveAndMove($Postbus_old, $Postbus_new) $oOApp = ObjCreate("Outlook.Application") $myNamespace =$oOApp.GetNamespace("MAPI") ; Original folder $myarrayold=StringSplit ( $Postbus_old, "\") $myOldFolder = $myNamespace.Folders($myarrayold[1]) For $i=2 to $myarrayold[0] $myOldFolder=$myOldFolder.Folders($myarrayold[$i]) next ; Folder to put the mail in $myarraynew=StringSplit ( $Postbus_new, "\") $myNewFolder = $myNamespace.Folders($myarraynew[1]) For $i=2 to $myarraynew[0] $myNewFolder=$myNewFolder.Folders($myarraynew[$i]) next $teller=0 ;Countback loop, this is because the mailitem index resets after each move For $a=$myOldFolder.Items.count to 1 Step -1 If $myOldFolder.Items($a).flagicon=3 then $teller=$teller+1 $iAttachCnt = $myOldFolder.Items($a).Attachments.Count If $iAttachCnt > 0 Then For $iAttachNum = 1 to $iAttachCnt $oTemp = $myOldFolder.Items($a).Attachments.Item($iAttachNum) $sFileName = $oTemp.FileName $oTemp = $myOldFolder.Items($a).Attachments.Item($iAttachNum) if stringinstr($sFileName,".pdf") > 0 then $oTemp.SaveAsFile ("c:\temp\" & $sFileName) endif Next EndIf ;Move mail after saving attachements $myoldfolder.Items($a).move ($myNewFolder) endif next return $teller endfunc OK, nice, but will it work if you have a folder that is on the same level as Inbox. Link to comment Share on other sites More sharing options...
Wooltown Posted July 8, 2009 Author Share Posted July 8, 2009 (edited) I got it to work with a little help from this topic http://www.autoitscript.com/forum/index.php?showtopic=80131&st=0&p=576853&hl=outlook&fromsearch=1&#entry576853 I will continue my work of the UDF This property would be useful, but it only works from Outlook 2007, we are using Outlook 2003. http://msdn.microsoft.com/en-us/library/bb175607.aspx Edited July 8, 2009 by Wooltown Link to comment Share on other sites More sharing options...
IQ9003 Posted July 8, 2009 Share Posted July 8, 2009 (edited) yes it also works for folders at the same level as the Inbox, but also to other users mailbox.(We also have Outlook2003)OK, nice, but will it work if you have a folder that is on the same level as Inbox. Edited July 8, 2009 by IQ9003 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