![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
![]()
I've successfully built my first Outlook addin using VB.NET 2003.
What I want to achieve is an addin that help file emails. When I message is sent a msgbox pops up asking the user if the email should be filed or not. I will implement a similar msgbox for when a new mail is read. However, in the short term I want to get something else working. My addin creates a toolbar button on standard toolbar. At the moment when a user clicks this button a msgbox appears telling them they have clicked it. What I want to to though is determine if a mail item is selected in a mailbox, if it is then I want to save the mail item and attachments something like this: Dim myMail As Outlook.MailItem ' Save new Data If MsgBox("Would you like to file the selected item?" & vbCrLf & myMail.Subject.ToString & _ vbCrLf & myMail.SentOn.ToString, MsgBoxStyle.YesNo, "Mail Manager") = MsgBoxResult.Cancel Then Exit Sub Else ' Open the save form in Dialog Mode Dim frm As New frmMain With frm .ShowDialog() .Dispose() 'save the message.... If frm.DialogResult = DialogResult.OK Then Dim sSaveMsg As String sSaveMsg = frm.sSavePath & "\" & myMail.To.ToString & "_" & RemoveIllegalCharacters(myMail.Subject.ToString) & ".msg" With myMail Dim i, iAttCount As Integer iAttCount = .Attachments.Count() For i = 1 To iAttCount If FileExists(frm.sSavePath & "\" & .Attachments.Item(i).FileName) = True Then .Attachments.Item(i).SaveAsFile(frm.sSavePath & "\" & ..Attachments.Item(i).FileName & " [ADDED - " & MonthShort() & "]") Else .Attachments.Item(i).SaveAsFile(frm.sSavePath & "\" & ..Attachments.Item(i).FileName) End If Next For i = 1 To iAttCount .Attachments.Remove(i) Next .SaveAs(sSaveMsg) End With End With End If How do I first detect if a mail item is selected? Project source attached.... TIA Russ Green |
Ads |
#2
|
|||
|
|||
![]()
this is in C#: but you would use the Explorer object,
this._outlookApplicationObject.ActiveExplorer().Se lection; This will give you access to the items that are currently selected in the active explorer. Rog Russ Green wrote: I've successfully built my first Outlook addin using VB.NET 2003. What I want to achieve is an addin that help file emails. When I message is sent a msgbox pops up asking the user if the email should be filed or not. I will implement a similar msgbox for when a new mail is read. However, in the short term I want to get something else working. My addin creates a toolbar button on standard toolbar. At the moment when a user clicks this button a msgbox appears telling them they have clicked it. What I want to to though is determine if a mail item is selected in a mailbox, if it is then I want to save the mail item and attachments something like this: Dim myMail As Outlook.MailItem ' Save new Data If MsgBox("Would you like to file the selected item?" & vbCrLf & myMail.Subject.ToString & _ vbCrLf & myMail.SentOn.ToString, MsgBoxStyle.YesNo, "Mail Manager") = MsgBoxResult.Cancel Then Exit Sub Else ' Open the save form in Dialog Mode Dim frm As New frmMain With frm .ShowDialog() .Dispose() 'save the message.... If frm.DialogResult = DialogResult.OK Then Dim sSaveMsg As String sSaveMsg = frm.sSavePath & "\" & myMail.To.ToString & "_" & RemoveIllegalCharacters(myMail.Subject.ToString) & ".msg" With myMail Dim i, iAttCount As Integer iAttCount = .Attachments.Count() For i = 1 To iAttCount If FileExists(frm.sSavePath & "\" & .Attachments.Item(i).FileName) = True Then .Attachments.Item(i).SaveAsFile(frm.sSavePath & "\" & .Attachments.Item(i).FileName & " [ADDED - " & MonthShort() & "]") Else .Attachments.Item(i).SaveAsFile(frm.sSavePath & "\" & .Attachments.Item(i).FileName) End If Next For i = 1 To iAttCount .Attachments.Remove(i) Next .SaveAs(sSaveMsg) End With End With End If How do I first detect if a mail item is selected? Project source attached.... TIA Russ Green |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
How do I get rid of an Outlook 2003 addin error message? | Glynn Brooks | Outlook - Installation | 0 | March 29th 06 07:25 PM |
program new toolbar in outlook with VB.NET 2003 | Oskar Vaia | Add-ins for Outlook | 2 | March 20th 06 04:34 PM |
.NET AddIn Question UserControl in Folder homepage | David Ing | Outlook and VBA | 8 | March 4th 06 01:24 PM |
Issues with .NET addin, web-services, and shimming | Sergey Anchipolevsky | Add-ins for Outlook | 0 | February 22nd 06 01:26 PM |
best way to support outlook 2000, 2002, and 2003 and .NET | Josh Einstein | Add-ins for Outlook | 1 | January 8th 06 08:30 AM |