Outlook 2013 Auto-Reply with retained information from previously received email - vb.net

Please see example email below:
"We have tickets available for the following basketball game:
Please email only me if you are interested and let me know which
section you want.
Please be sure to make your selection carefully and only reply once.
Basketball Game is on Tuesday 3/10 - 2 sets of 2 tickets.
Tuesday 3/19/2014 Cleveland 7:30PM
Section 101 Row K 16 – 17
Section 101 Row K 18 - 19
Section 124 Row K 1 - 2
Section 124 Row K 3 - 4"
How would I auto reply to this email with a default response of one of the selected rows?
For example, I would like my default auto-reply email to state the
following:
"Section 101 Row K 16-17. Thanks, Joe"
Details: I would like this to auto-reply to the sender EVERY time an email is received from the same sender. Basically I have to be the first to respond to an email in order to receive tickets to a basketball game. First come first serve.

You can create a VBA macro or develop an Outlook add-in if you need to get the code working on multiple PCs. The NewMailEx event of the Application class is fired when a new item is received in the Inbox.
But the simplest way is to develop a VBA macro which can be run by the Outlook rule. For example, the rule may recognize such emails and run a macro sub which should be in the following format:
public sub Test(mail as MailItem)
' do whatever you need there
end sub
where the mail object passed as an argument represents the incoming email.
In the sub you need to use the following methods from the Outlook object model:
The Reply method which creates a reply, pre-addressed to the original sender, from the original message.
The Body property which allows to set a string representing the clear-text body of the Outlook item.
The Send method which sends the e-mail message.
You may find the Getting Started with VBA in Outlook 2010 article in MSDN.

Related

Limit attendees for an Outlook e-invite

I am an amateur coder.
I need to limit an e-invite in Microsoft Outlook to a certain number of attendees.
E.g. I have 500 attendees and I want to limit registration via calendar e-invite acceptance from the 11th attendee onwards ( first come first serve basis for first 10 who signs up).
How can I do that?
Thanks!
The best what could do is to handle the NewMailEx event of the Application class which is fired once for every received item that is processed by Microsoft Outlook. The item can be one of several different item types, for example, MailItem, MeetingItem, or SharingItem. The EntryIDsCollection string contains the Entry ID that corresponds to that item. The NewMailEx event fires when a new message arrives in the Inbox and before client rule processing occurs. You can use the Entry ID returned in the EntryIDCollection array to call the NameSpace.GetItemFromID method and process the item.
So, you can track how many answers were received and modify the original appointment item to include only ten attendees.

FROM Name MailItem Property

I am trying to record tasks via sending an email in Outlook and I need to have the sender name in the body so the others know the task is assigned to them.
Using MailObj.SenderName does not use the FROM name it would look for the name of the recipient if I was replying.
If you want the current user information, use Application.Session.CurrentUser.

outlook vba code to display pictures in email

By default, my MS Outlook 2013 is set NOT to download images in received HTML e-mail messages. I would like to keep this setting.
There are some senders whose emails are handled by my Outlook VBA code...and filed into specific folders (rather than the INBOX). I do not use the in-built RULES.
These are known senders...and I would like to have the pictures in the emails from these SELECT KNOWN senders downloaded and displayed. I could do this manually for each email... by right clicking etc... but that is a pain... when there are many such emails.
I am unable to figure out the few lines of code (one line ?) required to download / enable display of images / pictures in the email. Something like... MailItem.Display (which does not work... it only displays the mail in an independent window)... or MailItem.DisplayImages (that is not a known method!).
I would include this one line (or lines) in the routine which handles emails from some known senders....so that their emails always have images / pictures downloaded and displayed.
Thanks.
You would need to set the PidTagBlockStatus property - see http://msdn.microsoft.com/en-us/library/ee219242(v=exchg.80).aspx.
Note that while you can read/write that property using MailItem.PropertyAccessor.SetProperty, you will not be able to calculate its value correctly - Outlook Object Model rounds off the value of the message delivery time, and you would need the raw Extended MAPI value (accessible in C++ or Delphi only) as the FileTime structure.
If using Redemption (I am its author) is an option, it exposes the RDOMail.DownloadPictures property. Something like the following should do the job (VB script):
set Session = CreateObject("Redemption.RDOSession")
Session.MAPIOBJECT = Application.Session.MAPIOBJECT
set Item = Session.GetRDOObjectFromOutlookObject(YourOutlookItem)
Item.DownloadPictures = true
Item.Save
The Outlook object model doesn't provide any property or method for that.

How can retrieve email address from the Infopath people/Group picker

How can retrieve email address from the Infopath people/Group picker?When I add the people/Group picker into the infopath form, I only get 3 fields DisplayName,AccountId,AccountType.Can anyone show me how can I get the email either by configurations or by code.
In SharePoint Designer, when setting up a workflow to respond to an InfoPath people picker field, I simply map the "TO:" field of my "Send Email" action to whatever people picker field I have (even if it's set to pull the Display Name)... and the email will successfully send out regardless. Now, your mileage may vary and perhaps it's due to our Exchange server settings and small company size which allows this to work.
Anyways, try it out. Maybe extracting an email address from the people picker is a superflous step.
I have a simpler solution.
Assume you are using the connection wizard to send an email to a person selected from a people picker.
in the to field -
concat(substring-after(AccountId, "\"), "#domain.com")
assuming your companies mail accounts have an entry for username # domain.
because AccountId = domain\username
so we end up with username#domain.com
Worked for me
Create a button and the following rules for that button.
Create a data Connection to retrieve from GetUserProfileByName.
Create a field to store the email you are retrieving.
Rules for the button
Rule 1 Set a fields value. Set the value of the AccountName of GetUserProfileByName to equal the AccountID from the people picker.
Rule 2 Add an Action to to Query the Data Connection GetUserProfileByName
Rule 3 set a fields value to the email address of the query you just performed
Filter Data
Change value to name
If you simply want to populate a field with the email address from your domain this works perfectly. I have been banging my head on the double eval trick for two days. I got it to work but the form rendering in SharePoint took 2 minutes and 46 seconds.
I know this is too late for the answer but still i am writing this so that someone can get help in future.
When we keep People picker it gives us three values which you specified (AccountId, DisplayName and AccountType).
Now if some one wants to retrieve the email address, there may be so many requirement but i guess most of the person want to send mail to the user which are selected into people picker.
If you want to send mail to selected user then you can just use AccountId field into your workflow item. SharePoint designer automatically detect the email address from the AccountId and sends the mail.
I hope this might save someone's time.

Set Email Flag Status in Outlook 2007

Is there a way in Outlook 2007 to set a follow-up flag on an email object? It looks like it was supported in Outlook 2003 with .FlagStatus property, but I can't find it in 2007.
From the outlook change notes:
For Follow Up Flags For Follow Up Flags, introduced in Microsoft Office Outlook 2003, are replaced by task flags and color categories. You no longer see colored flags in the Mail view. If you flagged items in the earlier version of Outlook to indicate that they were important or that they belonged to a particular group, you should now use color categories instead. If you used flags to indicate the time at which you were to take action on an item, you should now use task flags. This change is being made to increase the functionality of flags. With task flagging, you can place an item in the overall task management system, allowing you to see your tasks in the To-Do Bar, Daily Task List in Calendar, and in the Tasks view. By categorizing an item, you can easily scan your Inbox for categorized items, the same way that you might previously have scanned your Inbox for flagged items. You can also find categorized items in the Categorized Mail Search Folders.
So the concept of the flag changed, which is why the FlagStatus property has changed. According to this, the following should work:
Set SelectedItems = Outlook.ActiveExplorer.Selection
For Each Item In SelectedItems
With Item
.ToDoTaskOrdinal = dtTaskDate
.TaskDueDate = dtTaskDate
.TaskStartDate = dtTaskDate
.FlagStatus = 2
.FlagRequest = strFlagRequest
.Categories = strCategories
.FlagIcon = 6
.Save
End With
Next Item
This is what http://msdn.microsoft.com/en-us/library/microsoft.office.interop.outlook._mailitem.flagstatus.aspx has to say:
Dim instance As _MailItem
Dim value As OlFlagStatus
value = instance.FlagStatus
instance.FlagStatus = value