|
-
Oct 9th, 2005, 03:27 AM
#1
Thread Starter
Junior Member
forwarding a mail from a particular folder
Hi ,
I am developing an application,that needs me to list down all the mails in a
particular folder under INBOX folder say folder -xxx,the user must be able to
forward that particular item to any user.I am able to get all the mails from the INBOX using MAPI but i am not able to fetch it from the specified folder under INBOX. Please advice any example codes would be of great help.
Thanks ,
Khader
-
Oct 10th, 2005, 07:47 AM
#2
Re: forwarding a mail from a particular folder
Are you doing this in VB or Outlook VBA?
-
Oct 10th, 2005, 10:51 AM
#3
Re: forwarding a mail from a particular folder
How are you getting all the desired emails using mapi if you can not get the items? Are you using Outlook Object Model or VB's MAPI control?
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Oct 10th, 2005, 11:57 AM
#4
Thread Starter
Junior Member
Re: forwarding a mail from a particular folder
Hi Guys ,
Thanks for the response.See Currently i am using the MAPI to fetch all the mails from the inbox ,I am able to perform all the required funtions on them.
but the trouble is i want to fetch and do similar actions on the mail items from other folders too which are under the inbox.I tried using the outlook objects here to navigate thru the folders ,I am able to open the mail but i want to forward them .Hope this is makes the case clear.
Thanks ,
Khader
-
Oct 10th, 2005, 11:58 AM
#5
Thread Starter
Junior Member
Re: forwarding a mail from a particular folder
-
Oct 10th, 2005, 12:10 PM
#6
Re: forwarding a mail from a particular folder
Show us the code you are using now.
-
Oct 10th, 2005, 12:26 PM
#7
Re: forwarding a mail from a particular folder
So this is specifically for your Outlook and not for other systems?
If you create a search folder you could select all the found mail items and just forward them. Also, are you forwarding the emails to just one email arress or all different ones? Do you want to use the MAPI control or the Outook Object model?
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Oct 10th, 2005, 12:54 PM
#8
Thread Starter
Junior Member
Re: forwarding a mail from a particular folder
Hi Robbdog and HACK,
This is something that i used to move to a folder named "CAIT" ,I am also not sure how to declare myitems here.
VB Code:
Dim dosNameSpace As Outlook.NameSpace
Dim dosPublics As MAPIFolder
Dim myfolder As MAPIFolder
Set dosNameSpace = Application.GetNamespace("MAPI")
Set dosPublics = dosNameSpace.GetDefaultFolder(olFolderInbox) 'should be the public
Set myfolder = dosPublics.Folders("CAIT")
Set myitems = myfolder.Items
myitems(2).display
The following is my MAPI code that i use to fetch the mails and forward them
This is to fetch the mails from inbox to a flexgrid....
VB Code:
Private Sub Command2_Click()
'MAPISession1.SignOn
'MAPIMessages1.SessionID = MAPISession1.SessionID
MAPIMessages1.Fetch
For i = 0 To MAPIMessages1.MsgCount - 1
j = i + 1
flxinb.Rows = flxinb.Rows + 1
MAPIMessages1.MsgIndex = i
flxinb.Row = j
flxinb.Col = 0
flxinb.Text = MAPIMessages1.MsgOrigDisplayName
flxinb.Row = j
flxinb.Col = 1
flxinb.Text = MAPIMessages1.MsgSubject
flxinb.Row = j
flxinb.Col = 2
flxinb.Text = MAPIMessages1.MsgDateReceived
Next i
'MAPISession1.SignOff
End Sub
this is to forward ..
VB Code:
Private Sub cmdsnd_Click()
If rdfrw.Value = True Then
With MAPIMessages1
.Fetch
.MsgIndex = flxinb.Row - 1
.Forward
.MsgSubject = "Ticket ID"
.Show
.MsgNoteText = "Hi Bo /Note this following forwareded message"
MAPIMessages1.Send True
End With
Else
MsgBox "Please Select request type ", vbOKOnly, "ARM Ver 1.3"
End If
End Sub
While forwarding I also wanna use display the original message along with the new text .
Can you guys advice me on both my problem
1) To forward a mail from a particular folder under inbox by searching the subject line to any user.
2) To append the forwarded mail instead of over writing it.
Thanks and Regards,
Khader
Edit: Added [vbcode][/vbcode] tags for clarity and removed email address from post to protect member from possible spammers - Hack
Last edited by Hack; Oct 10th, 2005 at 01:00 PM.
-
Oct 10th, 2005, 01:31 PM
#9
Re: forwarding a mail from a particular folder
Looks like your using both the vb6 mapi control and the outlook object model. There is no need to use both. If you have Outlook and this is just for you then its easier to just use Outlook.
VB Code:
Option Explicit
'Add a reference to MS Outlook xx.0 Object Library
Private moApp As Outlook.Application
Private Sub Command1_Click()
Dim oInbox As Outlook.MAPIFolder
Dim i As Integer
Set oInbox = moApp.GetNamespace("MAPI").GetDefaultFolder(olFolderInbox)
For i = 1 To oInbox.Items.Count
flxinb.Row = i
flxinb.Col = 0
flxinb.Text = oInbox.Items.Item(i).Subject
flxinb.Row = i
flxinb.Col = 1
flxinb.Text = oInbox.Items.Item(i).SenderName
flxinb.Row = i
flxinb.Col = 2
flxinb.Text = oInbox.Items.Item(i).ReceivedTime
Next
Set oInbox = Nothing
End Sub
Private Sub Form_Load()
Set moApp = New Outlook.Application
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
moApp.Quit
Set moApp = Nothing
End Sub
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Oct 10th, 2005, 02:12 PM
#10
Thread Starter
Junior Member
Re: forwarding a mail from a particular folder
Hi RobDog,
I accept to the fact that we can use any one of either MAPI or outlook,
But my problem is that i need to forward mail and perform all functions on a particular mail that is present in a particular folder using a subject line search that is under INBOX .
hope i am clear
Khader
-
Oct 10th, 2005, 02:27 PM
#11
Re: forwarding a mail from a particular folder
Just do a loop checking the subject property. Then when found set a Mailitem object variable to that item and .Forward
VB Code:
If oInbox.Items.Item(i).Subject = "RE: Something" Then
Set oMsg = oInbox.Items.Item(i)
oMsg.Forward
oMsg.Send
End If
Check Outlooks help file for more info on the Fordward method. My code example is only detailed pseudocode.
Moved from Classic VB forum.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Oct 10th, 2005, 03:01 PM
#12
Thread Starter
Junior Member
Re: forwarding a mail from a particular folder
Hi RobDog,
Perfect Thanks a lot buddy will try that out ..Thanks a lot for all your help.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|