Jump to content

mdcastle

Active Members
  • Posts

    64
  • Joined

  • Last visited

mdcastle's Achievements

Wayfarer

Wayfarer (2/7)

0

Reputation

  1. water - please could you cast your eye on this script i'm attempting to use to access items in the Sent Items folder and possibly point out where i'm going wrong? #include <OutlookEx.au3> #include <Array.au3> ;Global $oSentItems = "\\Other User Mailbox\Sent Items" Global $oSentItems = "\\Other User Mailbox" Global $oOutlook = _OL_Open() If @error <> 0 Then Exit MsgBox(16, "Connect to Outlook", "Error connecting to Outlook. @error = " & @error & ", @extended = " & @extended) $aFolder = _OL_FolderAccess($oOutlook, $oSentItems, $olFolderSentMail, $olMailItem) If @error <> 0 Then MsgBox(16, "Connect to Folder", "Error connecting to Folder. @error = " & @error & ", @extended = " & @extended) $aItems = _OL_ItemFind($oOutlook, $aFolder[1], $olMail) _ArrayDisplay($aItems) After _OL_FolderAccess I get @error = 3 @ extended = 1
  2. water I fixed it myself by changing Local $PR_ATTACH_FLAGS = "<a href='http://schemas.microsoft.com/mapi/proptag/0x37140003' class='bbc_url' title='External link' rel='nofollow external'>http://schemas.microsoft.com/mapi/proptag/0x37140003"</a> Local $PR_ATTACHMENT_HIDDEN = "<a href='http://schemas.microsoft.com/mapi/proptag/0x7FFE000B' class='bbc_url' title='External link' rel='nofollow external'>http://schemas.microsoft.com/mapi/proptag/0x7FFE000B"</a> to be Local $PR_ATTACH_FLAGS = "http://schemas.microsoft.com/mapi/proptag/0x37140003" Local $PR_ATTACHMENT_HIDDEN = "http://schemas.microsoft.com/mapi/proptag/0x7FFE000B"
  3. Hi water A long time ago you suggested an amendment to _OL_ItemAttachmentGet that would pick up the type of attachment flag and if the attachment was hidden (code below): Func _OL_ItemAttachmentGet($oOL, $vOL_Item, $sOL_StoreID = Default) Local $PR_ATTACH_FLAGS = "<a href='http://schemas.microsoft.com/mapi/proptag/0x37140003' class='bbc_url' title='External link' rel='nofollow external'>http://schemas.microsoft.com/mapi/proptag/0x37140003"</a> Local $PR_ATTACHMENT_HIDDEN = "<a href='http://schemas.microsoft.com/mapi/proptag/0x7FFE000B' class='bbc_url' title='External link' rel='nofollow external'>http://schemas.microsoft.com/mapi/proptag/0x7FFE000B"</a> If Not IsObj($vOL_Item) Then If StringStripWS($vOL_Item, 3) = "" Then Return SetError(1, 0, 0) $vOL_Item = $oOL.Session.GetItemFromID($vOL_Item, $sOL_StoreID) If @error Then Return SetError(2, @error, 0) EndIf If $vOL_Item.Attachments.Count = 0 Then Return SetError(3, 0, 0) Local $aOL_Attachments[$vOL_Item.Attachments.Count + 1][9] = [[$vOL_Item.Attachments.Count, 9]] Local $iOL_Index = 1 For $oOL_Attachment In $vOL_Item.Attachments $aOL_Attachments[$iOL_Index][0] = $oOL_Attachment $aOL_Attachments[$iOL_Index][1] = $oOL_Attachment.DisplayName $aOL_Attachments[$iOL_Index][2] = $oOL_Attachment.FileName $aOL_Attachments[$iOL_Index][3] = $oOL_Attachment.PathName $aOL_Attachments[$iOL_Index][4] = $oOL_Attachment.Position $aOL_Attachments[$iOL_Index][5] = $oOL_Attachment.Size $aOL_Attachments[$iOL_Index][6] = $oOL_Attachment.Type $aOL_Attachments[$iOL_Index][7] = $oOL_Attachment.PropertyAccessor.GetProperty($PR_ATTACH_FLAGS) $aOL_Attachments[$iOL_Index][8] = $oOL_Attachment.PropertyAccessor.GetProperty($PR_ATTACHMENT_HIDDEN) $iOL_Index += 1 Next Return $aOL_Attachments EndFunc ;==>_OL_ItemAttachmentGet When adding this code back in to OutlookEX.au3 i get a syntax error relating to the quotes around the Local $PR_ATTACH_FLAGS and Local $PR_ATTACHMENT_HIDDEN lines, so i moved the quotes to the other side of the </a> tag, which removes the syntax error. However, even when I do that $aOL_Attachments[$iOL_Index][7] and $aOL_Attachments[$iOL_Index][8] are not being populated with any information. Could you help?
  4. I think this is due to non-standard characters in $sFName (possibly [TAB] ??), as when I remove this from the line $aAttachments[$iIndex][0] .SaveAsFile($sDrive & $sDir & $sFName & "_" & $aAttachments[$iIndex][2]) the attachment saves ok.
  5. This is a snippet of my code. ; Get a list of attachments and save non-PDF attachments for changing to PDFs For $i = 1 To $aResult[0][0] ConsoleWrite("Email Subject: " & $aResult[$i][1] & @CRLF) $aAttachments = _OL_ItemAttachmentGet($oOutlook, $aResult[$i][0]) For $j = $aAttachments[0][0] To 1 Step -1 If $aAttachments[$j][7] = "4" AND $aAttachments[$j][8] = "True" Then _OL_ItemAttachmentDelete($oOutlook, $aResult[$i][0], Default, $j) If @error <> 0 Then MsgBox(16, "Error", "Error deleting the attachment. @error = " & @error & ", @extended = " & @extended) EndIf Next $aAttachments1 = _OL_ItemAttachmentGet($oOutlook, $aResult[$i][0]) For $t = 1 to $aAttachments1[0][0] If StringRegExp($aAttachments1[$t][2], "pdf$|PDF$") Then ConsoleWrite(" Attachment filename: " & $aAttachments[$t][2] & @CRLF) ElseIf StringRegExp($aAttachments1[$t][2], "msg$|MSG$") Then ConsoleWrite(" Email Attachment" & @CRLF) _OL_ItemModify($oOutlook, $aResult[$i][0], Default, "Categories=Email-Attachment", "UnRead=False" ) ExitLoop Else _OL_ItemSave($oOutlook, $aResult[$i][0], Default, $SavePath & "", $olHTML, 2) ; !! This is the problem line !! If @error <> 0 Then MsgBox(16, "Error", "Error saving attachments from email '" & $aResult[$i][1] & "' to PDFConversionArea folder. @error = " & @error & ", @extended = " & @extended & @CRLF & @CRLF & "Exiting the script.") FileDelete($SavePath & "") Global $aItems2 = _OL_ItemFind($oOutlook, $aFolder[1], $olMail, "[Categories]=Non-PDF", "", "", "EntryID,Subject,Body,SentOn") If $aItems2[0][0] > 0 Then For $y = 1 To $aItems2[0][0] _OL_ItemModify($oOutlook, $aItems2[$y][0], Default, "Categories=AutoIT", "UnRead=False" ) Next EndIf Exit Else ConsoleWrite("Files saved succesfully" & @CRLF) EndIf ; Set 'Non-PDF' category _OL_ItemModify($oOutlook, $aResult[$i][0], Default, "Categories=Non-PDF", "UnRead=False" ) If @error <> 0 Then Exit MsgBox(16, "Update Category", "Error marking item with 'Non-PDF' category. @error = " & @error & ", @extended = " & @extended) ExitLoop EndIf Next Next
  6. water I'm having problems using _OL_ItemSave, specifically @error = 5, @extended = -2147352567. I've looked this up in OutlookSpy and it gives the error of 'DISP_E_EXCEPTION'. I've googled this and it gives 'Cannot save the attachments. Outlook cannot do this action on this type of attachment'. The attachment is just a standard MS Word document (.doc) and nothing looks out of place in the IMessage > GetAttachmentTable part of OutlookSpy. Have you an idea what is going wrong?
  7. Hi water I'm hoping you can help me, again! I have the following code that loops through and deletes attachments: For $i = 1 To $aResult[0][0] $aAttachments = _OL_ItemAttachmentGet($oOutlook, $aResult[$i][0]) For $j = 1 To $aAttachments[0][0] If $aAttachments[$j][7] = "4" AND $aAttachments[$j][8] = "True" Then _OL_ItemAttachmentDelete($oOutlook, $aResult[$i][0], Default, $j) If @error <> 0 Then MsgBox(16, "Error", "Error deleting the attachment. @error = " & @error & ", @extended = " & @extended) EndIf Next Next The problem is I need to refresh the list of attachments each time one is deleted as the attachment number changes after each attachment is deleted. I'm sure its easy but I've got a mental block Many thanks in advance.
  8. Absolutely fine. Thanks for showing me the required code.
  9. works great thanks very much
  10. Unfortunately not as both types of attachment are 1 (olByValue)
  11. water I have a need to save attachments from a Mail Item where the attachment is a 'true' attachment, rather than an 'inline' attachment e.g. a picture within the html body. I've used Outlook Spy to determine that the property tags that distinguish the two types are PR_ATTACH_FLAGS and PR_ATTACHMENT_HIDDEN. PR_ATTACH_FLAGS = 4 for an 'inline' attachment, 0 for a true attachment PR_ATTACHMENT_HIDDEN = true for 'inline' attachment, false for a 'true' attachment I've had a look at _OL_ItemSave with a view to update it (i discounted _OL_ItemAttachmentGet as I will have attachments with the same filename) however i'm stuck on how to add the IF statement that would only save the 'true' attachments. Would you be willing to help?
  12. One quick thing I have noticed - in your reproducer script there is a line: $aRecipCheck = _OL_ItemRecipientCheckEX($oOutlook, $stringSendTo) The function you posted earlier was called _OL_ItemRecipientCheck. I had to change _OL_ItemRecipientCheckEx to _OL_ItemRecipientCheck to get the reproducer script to work. Was this just a typo or am I missing a new version of the function? To answer your post.... I'm selecting a person rather than a resource. The content of the email tab is long, listing the various email domains we use (it would appear that firstname.surname@domain.com is valid for all the domains we use). e.g. smtp:firstname.surname@domain1.com smtp:firstname.surname@domain2.com etc Interestingly if I follow the steps below, the email resolves ok sometimes and doesn't resolve other times: - when 'select names' dialog appears, rather than clicking Ok, type $stringSendTo value in to box - double click correct name from resulting list - name is resolved successfully in 'To' field (along with unresolved name passed by $stringSendTo - delete unresolved name from 'To' field - click 'Ok' $iOL_Debug = 2 reports 'Outlook does not recognize one or more names'. Additionally, bizarrely, when the 'check names' dialog appears, if I click the other name, then click back on the correct name the email resolves ok - very strange behaviour!
  13. Thanks water Unfortunately the same problem occurs. Steps to reproduce = - (run reproducer script) - MailItem is displayed - Global Address List is displayed with $stringSendTo displayed in 'To' field - Click 'Ok' in Global Address List - 'Check Names' dialogue appears with two entries - Required entry selected and 'Ok' clicked - _OL_ItemSend returns @error = 2 @ extended = -2147352567
  14. Outlook 2010 I'm not sure what line 3470 is, as my script only has 538 lines. Are the other lines the includes? I've got IE.au3, Date.au3, Excel.au3 and OutlookEx.au3. Is there another way to get what is being called on line 3470?
×
×
  • Create New...