Xtreme Visual Basic Talk

Xtreme Visual Basic Talk (http://www.xtremevbtalk.com/)
-   .NET Office Automation (http://www.xtremevbtalk.com/-net-office-automation/)
-   -   VB.NET to open contact from received email (http://www.xtremevbtalk.com/-net-office-automation/327623-vb-net-contact-received-email.html)

silenttalk 05-18-2015 01:18 PM

VB.NET to open contact from received email

Pulling my hair over this one. very new to VS 2013 but have extensive background with outlook VBS/VBA coding.

We send emails out to a bunch of subscribers for a re booking situation for a membership system. Although we hold the subscribers current email address, they sometimes respond from an alternative (or Alias address) which then fails if we click through to the contact card in Outlook as it is not recognized). I developed a better method using VBS that embedded the Outlook 'Firstname' 'lastname' values in the message that they need to respond to. I then used this to hook a hypertext link to the contact locally such as <outlook:contacts/~fred blogs> which works fine, but some web mail systems i.e. Hotmail strip hyperlink from the reply email (presumably for security reasons). Hotmails Apps under Windows 8 and Outlook work fine though.

So i started developing an addin for out look with a form region on all email messages, simple two buttons on the form, open the contact that replied in the current email message and secondly move the message to a specific folder.

So i want to validate the Contact to open by text that i have embedded in the outbound email that they respond to, lets say 'Renewal Subscription for Fred Bloggs'

What i want the button I click in the form region to do is to parse the email of the current email and open the contact that resonds to 'Renewal Subscription for Fred Bloggs'.

i have code that works for a fixed contact as below but cant work out how to dynamically populate the Fullname variable :-

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim objOutlook As Outlook.Application
Dim fullname As String = "Fred Bloggs"
Dim objNS As Outlook.NameSpace
Dim objAddressList As Outlook.MAPIFolder
objOutlook = New Outlook.Application()
objNS = objOutlook.Session
objAddressList = objNS.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderContacts)
'Find the contact by his full name
Dim objItems As Outlook.Items = objAddressList.Items
Dim objContact As Outlook.ContactItem = objItems.Find("[FullName] = '" & fullname & "'") 'ComboBox1.SelectedItem.ToString() & "'")
objContact.Display(True) 'calling this in modal or non modal makes no difference
objContact = Nothing
objItems = Nothing
objAddressList = Nothing
End Sub

Any help would be so gratefully received as i just cant seem to Google my way out of this, and a really nice guy from this forum helped me out 10 years ago 'Robb Dog'

here is hoping again ;)


All times are GMT -6. The time now is 03:24 PM.

Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2018, vBulletin Solutions, Inc.
Search Engine Optimisation provided by DragonByte SEO v2.0.15 (Lite) - vBulletin Mods & Addons Copyright © 2018 DragonByte Technologies Ltd.
All site content is protected by the Digital Millenium Act of 1998. Copyright©2001-2011 MAS Media Inc. and Extreme Visual Basic Forum. All rights reserved.
You may not copy or reproduce any portion of this site without written consent.