mailitem

Type Mismatch in mailitem loop

断了今生、忘了曾经 提交于 2019-12-02 10:28:40
Outlook 2010 VBA. Trying to search for flagged messages in all my folders. Created this: Private Sub flagrecurse(fold As Variant) Dim olItem As MailItem Dim nxtfold As Folder Dim olFoldVar As Variant 'Test for which folder is being checked MsgBox (fold.Name) If fold.Folders.Count > 0 Then For Each nxtfold In fold.Folders Set olFoldVar = nxtfold flagrecurse olFoldVar Next nxtfold Else For Each olItem In fold.Items 'Test for which item is being checked If TypeName(olItem) = "MailItem" Then MsgBox (olItem.Subject) With olItem If .FlagRequest <> "" Or .IsMarkedAsTask Then '.TaskDueDate = Now 'Sets

Outlook VBA— Some MailItem Properties return values, others do not

北城以北 提交于 2019-12-02 05:24:29
EDIT: New info: I just now realised that, while the return of Mailitem.Body is "", the actual value is "Application-defined or object-defined error" . I'm not entirely sure what that means, but I do know it shows up in multiple fields-- I included a screen shot below. I am having an issue where certain properties will return the correct value, and others will not. I have an example email, where I have an email with subject "Subject", the message is "Body", the sender email address is "email@address.com", and the date sent is 12 June 2013. When I run the following code: Dim ComputerName As

Get named MAPI Property from MailItem in C#

时光毁灭记忆、已成空白 提交于 2019-12-02 02:56:40
问题 I'm developing an Outlook 2010 custom plugin in C#. This is my first time using C# (I'm a java guy normally). There is a named (custom) MAPI property on a message that I would like to access and am having trouble doing so. My understanding is that in Outlook 2007 the PropertyAccessor object was introduced which allows easy access to named MAPI properties. I followed the instructions from the following documentation: http://msdn.microsoft.com/en-us/library/ff868915.aspx I can see the named

Open Outlook mail Item using EntryID, StoreID, and / or PR_ENTRYID

别来无恙 提交于 2019-11-30 19:28:45
NOTE: I'm using VBA and Office 2007. (I would use C#, but the project parameters don't allow this) I'm attempting to find some method in Outlook, or an API, that will allow me to open an Outlook mail item by providing either the Outlook EntryID or the MAPI "PR_ENTRYID" property from an Access Database. I have found many references to said code, but I have never seen anyone actually post a solution. I have attempted in include references to mapi32.dll and OLMAPI32.dll, but I get the following error: "Can't add a reference to the specified file." I'm guessing this is because those dll's are

Open Outlook mail Item using EntryID, StoreID, and / or PR_ENTRYID

北城余情 提交于 2019-11-30 03:32:38
问题 NOTE: I'm using VBA and Office 2007. (I would use C#, but the project parameters don't allow this) I'm attempting to find some method in Outlook, or an API, that will allow me to open an Outlook mail item by providing either the Outlook EntryID or the MAPI "PR_ENTRYID" property from an Access Database. I have found many references to said code, but I have never seen anyone actually post a solution. I have attempted in include references to mapi32.dll and OLMAPI32.dll, but I get the following

When is a MailItem not a MailItem? [closed]

醉酒当歌 提交于 2019-11-28 00:57:14
I have written a message handler function in Outlook's Visual Basic (we're using Outlook 2003 and Exchange Server) to help me sort out incoming email. It is working for me, except sometimes the rule fails and Outlook deactivates it. Then I turn the rule back on and manually run it on my Inbox to catch up. The rule spontaneously fails and deactivates several times a day. I would love to fix this once and for all. This code showed me the different TypeNames that were in my Inbox: Public Sub GetTypeNamesInbox() Dim myOlItems As Outlook.Items Set myOlItems = application.GetNamespace("MAPI")

How can I get the sender email address using Outlook.MailItem in VB.NET?

霸气de小男生 提交于 2019-11-27 12:28:31
问题 I have tried using mailItem.SenderEmailAddress and mailItem.Sender.Address but they both return a string that looks like this: /O=DOMAINNAME/OU=EXCHANGE ADMINISTRATIVE GROUP (FYDIBOHI43SPCLT)/CN=RECIPIENTS/CN=JOE BLOGGS8C3 Where in reality I want joebloggs@domainname.co.uk to be retrurned. Anyone have any ideas? Thank you very much. Edit: I have done some digging; it works perfectly for email addresses of the 'SenderEmailType' SMTP, it just doesn't work for Exchange email addresses. Edit 2: I

How do I open an outlook .msg file from my harddrive that is NOT in outlook?

非 Y 不嫁゛ 提交于 2019-11-26 21:51:18
问题 I have searched high and low for this seemingly simple task, but all references I come across are either saving to the hard-drive or reading from an outlook folder. I have the following code that loops through file names in a folder on my hard-drive, but I do not know how to take that path and open it with outlook. Dim inPath as String Dim thisFile as String Dim msg as MailItem Dim OlApp as Object Set OlApp = CreateObject("Outlook.Application") inPath = "C:\temp" thisFile = Dir(inPath & "\*

Can I iterate through all Outlook emails in a folder including sub-folders?

匆匆过客 提交于 2019-11-26 03:40:00
问题 I have a folder which contains a number of emails and sub-folders. Within those sub-folders are more emails. I\'d like to write some VBA which will iterate through all emails in a certain folder, including those in any of the sub-folders. The idea is to extract the SenderEmailAddress and SenderName from every email and do something with it. I\'ve tried just exporting the folder as CSV with only these two fields and whilst this works, it doesn\'t support exporting emails held in sub-folders.