Posts 1 - 10 of 19
First | Prev. | 1 2 | Next | Last
|
|
Wayne Taylor
Posts: 14
Joined: 2006-05-02
|
How is it possible to capture the arrival of new mail in the Inbox folder, transfer that item to the folder associated with a form, then run some code from that form?
I'm trying to develop an add-in that will check for new mail from a specific address, then perform some (as yet, unspecific) action on it.
Cheers,
Wayne
|
|
Posted 02 May, 2006 03:56:45
|
|
Top
|
|
Sergey Grischenko
Add-in Express team
Posts: 7235
Joined: 2004-07-05
|
|
Posted 02 May, 2006 17:22:07
|
|
Top
|
|
Wayne Taylor
Posts: 14
Joined: 2006-05-02
|
Thanks Sergey, but is there a VB version?
Wayne |
|
Posted 03 May, 2006 11:05:13
|
|
Top
|
|
Sergey Grischenko
Add-in Express team
Posts: 7235
Joined: 2004-07-05
|
Hi Wayne.
No, there is not.
Is it difficult for you to rewrite C# code in VB.NET? |
|
Posted 03 May, 2006 11:25:32
|
|
Top
|
|
Wayne Taylor
Posts: 14
Joined: 2006-05-02
|
Umm, maybe. I have zero experience with C# |
|
Posted 05 May, 2006 07:36:21
|
|
Top
|
|
Sergey Grischenko
Add-in Express team
Posts: 7235
Joined: 2004-07-05
|
Hi Wayne.
Ok. I will rewrite it in VB.NET. |
|
Posted 05 May, 2006 08:45:04
|
|
Top
|
|
Sergey Grischenko
Add-in Express team
Posts: 7235
Joined: 2004-07-05
|
|
Posted 08 May, 2006 12:10:19
|
|
Top
|
|
Wayne Taylor
Posts: 14
Joined: 2006-05-02
|
Thanks Sergey for the example.
I'm now having a bit of trouble getting the mail items' info (sender, body, subject, etc). I thought I might create a class to help out....
Imports Outlook = Microsoft.Office.Interop.Outlook
Imports Microsoft.Office.Interop.Outlook
Public Class NewMail
Private _MailID As String
Private _Subject As String
Private _Sender As String
Private _Body As String
Private _HTMLBody As String
Public Sub New(ByVal MailID As String)
_MailID = MailID
GetDetails()
End Sub
Public ReadOnly Property Body() As String
Get
Return _Body
End Get
End Property
Public ReadOnly Property Subject() As String
Get
Return _Subject
End Get
End Property
Public ReadOnly Property Sender() As String
Get
Return _Sender
End Get
End Property
Public ReadOnly Property HTMLBody() As String
Get
Return _HTMLBody
End Get
End Property
Private Function GetDetails()
Dim mai As Outlook.MailItem
Dim OutlookApp As Outlook.Application
mai = OutlookApp.Session.GetItemFromID(_MailID)
_Sender = mai.SenderEmailAddress
_Subject = mai.Subject
If mai.BodyFormat = OlBodyFormat.olFormatHTML Then
_HTMLBody = mai.HTMLBody
ElseIf mai.BodyFormat = OlBodyFormat.olFormatPlain Or mai.BodyFormat = OlBodyFormat.olFormatRichText Then
_Body = mai.Body
End If
End Function
End Class
....but it keeps erroring out on this line....
mai = OutlookApp.Session.GetItemFromID(_MailID)
Any ideas?
Cheers,
Wayne |
|
Posted 11 May, 2006 08:32:30
|
|
Top
|
|
Sergey Grischenko
Add-in Express team
Posts: 7235
Joined: 2004-07-05
|
Hi Wayne.
Do you take into consideration that the entryID of the Outlook mail is changed when you move it to another folder? |
|
Posted 11 May, 2006 09:09:26
|
|
Top
|
|
Wayne Taylor
Posts: 14
Joined: 2006-05-02
|
I haven't moved it yet. So far I've only been testing to see if I can retrieve the info....
Private Sub adxOutlookEvents_NewMailEx(ByVal sender As Object, ByVal entryIDCollection As String) Handles adxOutlookEvents.NewMailEx
Dim ids As String() = entryIDCollection.Split(",")
Dim i As Integer
For i = 0 To ids.Length - 1
If AddNamedProperty(ids(i), "MyNamedProperty", "My Property Value.") Then
Dim MailItem As New NewMail(ids(i))
MsgBox(MailItem.Subject)
End If
Next i
End Sub |
|
Posted 11 May, 2006 09:24:08
|
|
Top
|
|
Posts 1 - 10 of 19
First | Prev. | 1 2 | Next | Last
|