Results 1 to 21 of 21

Thread: vs 2003 and outlook?

  1. #1

    Thread Starter
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428

    vs 2003 and outlook?

    umm does vs2003 integrate with outlook anyhow? I wanna write an app that opens a bunch of emails and I dont know if it's directly supported by framework 1.1 classes or not give me some clues.........
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  2. #2
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: vs 2003 and outlook?

    no, buy you can reference outlook for automation via COM

  3. #3
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: vs 2003 and outlook?

    This should get you started.
    VB Code:
    1. 'Add a reference to MS Outlook xx.0 Object Library
    2. 'Project > Add Reference... > COM tab > select MS Outlook 11.0 Object library
    3. Public Class Form1
    4.  
    5.     Inherits System.Windows.Forms.Form
    6.  
    7.     Public moApp As Outlook.Application
    8.     Public moNS As Outlook.NameSpace
    9.  
    10.     '"Windows Form Designer generated code"
    11.  
    12.     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    13.         Dim oFolder As Outlook.MAPIFolder
    14.         Dim oEmail As Outlook.MailItem
    15.  
    16.         oFolder = moNS.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox)
    17.         If oFolder.Items.Count > 0 Then
    18.             oEmail = oFolder.Items.Item(1)
    19.             MessageBox.Show(oEmail.Subject, ".NET Outlook Demo", MessageBoxButtons.OK, MessageBoxIcon.Information)
    20.         Else
    21.             MessageBox.Show("No items found!", ".NET Outlook Demo", MessageBoxButtons.OK, MessageBoxIcon.Information)
    22.         End If
    23.         oEmail = Nothing
    24.         oFolder = Nothing
    25.  
    26.     End Sub
    27.  
    28.     Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    29.         moApp = New Outlook.Application
    30.         moNS = moApp.GetNamespace("MAPI")
    31.     End Sub
    32.  
    33. End Class
    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 PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI 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

  4. #4

    Thread Starter
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428

    Re: vs 2003 and outlook?

    ah 2 thumbs up thanks a lot... spent 40 mins in the vb6 editor of outlook and only figured this much out
    Dim mee As MAPIFolder
    Set mee = Outlook.Session.Folders.Item(2)
    Dim inbox As Object
    Set inbox = mee .Folders.Item(2)


    Dim i As Integer
    Dim s As String

    For i = 1 To inbox.Items.Count
    s = s & inbox.Items.Item(i)
    Next



    umm ok so does outlook have to be open for all these to work?
    I"m gonna try working on this later... midterm tomorrow, but thanks for the help
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  5. #5
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: vs 2003 and outlook?

    You need to create a New instance of the Application Object which basically opens Outlook.

    What are you trying to do? Maybe a better way?
    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 PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI 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

  6. #6

    Thread Starter
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428

    Re: vs 2003 and outlook?

    Quote Originally Posted by RobDog888
    You need to create a New instance of the Application Object which basically opens Outlook.

    What are you trying to do? Maybe a better way?
    umm
    one particular folder in one of the accounts that I have receives a bunch of mails. I need to open each mail and locate every url in it (basically find all the URLs in all the emails that I have in that folder). Then I try to download the http page that the url points to...... dont ask why
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  7. #7
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: vs 2003 and outlook?

    But I want to ask why?

    I thought that maybe you were trying to replicate the welcome screen in XP where it displays the number of unread
    new emails received.

    Are your emails all HTML body format? or a combination of pain/rich/html text?
    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 PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI 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

  8. #8

    Thread Starter
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428

    Re: vs 2003 and outlook?

    Quote Originally Posted by RobDog888
    But I want to ask why?

    I thought that maybe you were trying to replicate the welcome screen in XP where it displays the number of unread
    new emails received.

    Are your emails all HTML body format? or a combination of pain/rich/html text?
    umm not sure what I'll be getting. I expect them to be HTML... I mean I can parse through it myself. My problem is that I dont know how to open each mail. If I can examine each email one by one then I can do the rest...
    as to why there is this company that sends advertisements out and if I subscribe and "read" each email (by clicking on links) I get 2 cents per email... so if I do a lot of it with a program I get a few dollars a month
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  9. #9
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: vs 2003 and outlook?

    Oh, ok. so when so I get my cut?

    I'll expand on the code I posted to enumerate the items in this folder called ???
    Give me a few minutes. I need to enter in my time card so I can get paid
    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 PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI 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

  10. #10
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: vs 2003 and outlook?

    Will this be for Outlook 2003 only?
    I'm almost done but if I need to handle different version of Outlook then I need to know.

    Ps, you get to do the parsing
    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 PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI 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

  11. #11
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: vs 2003 and outlook?

    Ok, I did my part now its up to you
    VB Code:
    1. Option Explicit On
    2.  
    3. 'Add a reference to MS Outlook xx.0 Object Library
    4. 'Project > Add Reference... > COM tab > select MS Outlook 11.0 Object library
    5. Imports Microsoft.Office.Interop
    6.  
    7. Public Class Form1
    8.  
    9.     Inherits System.Windows.Forms.Form
    10.  
    11. #Region " Outlook Variables "
    12.     Private moApp As Outlook.Application
    13.     Private moNS As Outlook.NameSpace
    14.     Private moFolder As Outlook.MAPIFolder
    15.     Private mbTerminate As Boolean
    16. #End Region
    17.  
    18. #Region " Outlook Constants "
    19.     Private Const olMail = 43
    20.     Private Const olFormatUnspecified = 0
    21.     Private Const olFormatPlain = 1
    22.     Private Const olFormatHTML = 2
    23.     Private Const olFormatRichText = 3
    24. #End Region
    25.  
    26. #Region " Windows Form Designer generated code "
    27.  
    28.     Public Sub New()
    29.         MyBase.New()
    30.  
    31.         'This call is required by the Windows Form Designer.
    32.         InitializeComponent()
    33.  
    34.         'Add any initialization after the InitializeComponent() call
    35.  
    36.     End Sub
    37.  
    38.     'Form overrides dispose to clean up the component list.
    39.     Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
    40.         If disposing Then
    41.             If Not (components Is Nothing) Then
    42.                 components.Dispose()
    43.             End If
    44.         End If
    45.         MyBase.Dispose(disposing)
    46.     End Sub
    47.  
    48.     'Required by the Windows Form Designer
    49.     Private components As System.ComponentModel.IContainer
    50.  
    51.     'NOTE: The following procedure is required by the Windows Form Designer
    52.     'It can be modified using the Windows Form Designer.  
    53.     'Do not modify it using the code editor.
    54.     Friend WithEvents btnClose As System.Windows.Forms.Button
    55.     Friend WithEvents btnBrowse As System.Windows.Forms.Button
    56.     Friend WithEvents txtFolderPath As System.Windows.Forms.TextBox
    57.     Friend WithEvents lblFolderPath As System.Windows.Forms.Label
    58.     Friend WithEvents btnParse As System.Windows.Forms.Button
    59.     <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
    60.         Me.btnClose = New System.Windows.Forms.Button
    61.         Me.btnBrowse = New System.Windows.Forms.Button
    62.         Me.txtFolderPath = New System.Windows.Forms.TextBox
    63.         Me.lblFolderPath = New System.Windows.Forms.Label
    64.         Me.btnParse = New System.Windows.Forms.Button
    65.         Me.SuspendLayout()
    66.         '
    67.         'btnClose
    68.         '
    69.         Me.btnClose.Location = New System.Drawing.Point(208, 96)
    70.         Me.btnClose.Name = "btnClose"
    71.         Me.btnClose.TabIndex = 0
    72.         Me.btnClose.Text = "&Close"
    73.         '
    74.         'btnBrowse
    75.         '
    76.         Me.btnBrowse.Location = New System.Drawing.Point(264, 40)
    77.         Me.btnBrowse.Name = "btnBrowse"
    78.         Me.btnBrowse.Size = New System.Drawing.Size(20, 20)
    79.         Me.btnBrowse.TabIndex = 1
    80.         Me.btnBrowse.Text = "..."
    81.         '
    82.         'txtFolderPath
    83.         '
    84.         Me.txtFolderPath.Location = New System.Drawing.Point(16, 40)
    85.         Me.txtFolderPath.Name = "txtFolderPath"
    86.         Me.txtFolderPath.Size = New System.Drawing.Size(248, 20)
    87.         Me.txtFolderPath.TabIndex = 2
    88.         Me.txtFolderPath.Text = ""
    89.         '
    90.         'lblFolderPath
    91.         '
    92.         Me.lblFolderPath.Location = New System.Drawing.Point(16, 24)
    93.         Me.lblFolderPath.Name = "lblFolderPath"
    94.         Me.lblFolderPath.Size = New System.Drawing.Size(100, 16)
    95.         Me.lblFolderPath.TabIndex = 3
    96.         Me.lblFolderPath.Text = "Folder Path:"
    97.         '
    98.         'btnParse
    99.         '
    100.         Me.btnParse.Location = New System.Drawing.Point(124, 96)
    101.         Me.btnParse.Name = "btnParse"
    102.         Me.btnParse.TabIndex = 4
    103.         Me.btnParse.Text = "Parse Links"
    104.         '
    105.         'Form1
    106.         '
    107.         Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
    108.         Me.ClientSize = New System.Drawing.Size(292, 126)
    109.         Me.Controls.Add(Me.btnParse)
    110.         Me.Controls.Add(Me.lblFolderPath)
    111.         Me.Controls.Add(Me.txtFolderPath)
    112.         Me.Controls.Add(Me.btnBrowse)
    113.         Me.Controls.Add(Me.btnClose)
    114.         Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle
    115.         Me.MaximizeBox = False
    116.         Me.Name = "Form1"
    117.         Me.Text = "Outlook Link Parser™"
    118.         Me.ResumeLayout(False)
    119.  
    120.     End Sub
    121.  
    122. #End Region
    123.  
    124.     Private Sub btnParse_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnParse.Click
    125.         Dim oEmail As Outlook.MailItem
    126.         Dim i As Integer
    127.         For i = 1 To moFolder.Items.Count
    128.             'Check for mailitems only and not undeliverable errors, meeting requests, or other non-mail items.
    129.             If moFolder.Items(i).Class = olMail Then
    130.                 oEmail = moFolder.Items.Item(i)
    131.                 'Check for body format type
    132.                 Select Case oEmail.BodyFormat
    133.                     Case Outlook.OlBodyFormat.olFormatUnspecified
    134.                         'Try to parse using plain text format?
    135.  
    136.                     Case Outlook.OlBodyFormat.olFormatPlain
    137.                         'Try to parse text
    138.                         If oEmail.Body.IndexOf("http://www.vbforums.com") > 0 Then
    139.                             Console.WriteLine(oEmail.Body.Substring(oEmail.Body.IndexOf("http://www.vbforums.com"), 23))
    140.                         End If
    141.                     Case Outlook.OlBodyFormat.olFormatHTML
    142.                         'Try to parse html
    143.                         If oEmail.HTMLBody.IndexOf("http://www.vbforums.com") > 0 Then
    144.                             'Do other stuff
    145.                             '...
    146.                         End If
    147.                     Case Outlook.OlBodyFormat.olFormatRichText
    148.                         'Try to parse RTF
    149.  
    150.                 End Select
    151.                 oEmail = Nothing
    152.             End If
    153.         Next
    154.         oEmail = Nothing
    155.         Me.Activate()
    156.         MessageBox.Show("Done!", "Outlook Link Parser™", MessageBoxButtons.OK, MessageBoxIcon.Information)
    157.     End Sub
    158.  
    159.     Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    160.         mbTerminate = False
    161.         moApp = GetObject(, "Outlook.Application")
    162.         If moApp Is Nothing Then
    163.             moApp = New Outlook.Application
    164.             mbTerminate = True
    165.         End If
    166.         moNS = moApp.GetNamespace("MAPI")
    167.     End Sub
    168.  
    169.     Private Sub btnBrowse_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBrowse.Click
    170.         moFolder = moNS.PickFolder
    171.         If Not moFolder Is Nothing Then
    172.             txtFolderPath.Text = moFolder.FolderPath
    173.         End If
    174.         Me.Activate()
    175.     End Sub
    176.  
    177.     Private Sub btnClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClose.Click
    178.         Me.Dispose()
    179.     End Sub
    180.  
    181.     Private Sub Form1_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
    182.         moFolder = Nothing
    183.         moNS = Nothing
    184.         If Not (moApp Is Nothing) And (mbTerminate = True) Then
    185.             moApp.Quit()
    186.         End If
    187.         moApp = Nothing
    188.     End Sub
    189.  
    190. End Class
    Last edited by RobDog888; Apr 19th, 2005 at 03:51 PM.
    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 PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI 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

  12. #12

    Thread Starter
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428

    Re: vs 2003 and outlook?

    whoa thats a lot of code and effort thanks!!!!!!!!! I'll see what I can make out of it
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  13. #13

    Thread Starter
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428

    Re: vs 2003 and outlook?

    hmm feeling dumb
    I added that com reference, but it says it cant find the namespace on the imports line :
    Imports Microsoft.Office.Interop

    what else do I need to add
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  14. #14
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: vs 2003 and outlook?

    No effort when you have been automating Outlook for a few years. I wrote it in a few minutes during lunch.
    Automating Office Apps is my FortÉ

    Consider it payback for all the help you have given me with learning VB.NET
    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 PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI 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

  15. #15
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: vs 2003 and outlook?

    Ok, I pasted in my code into an existing Outlook test project and rebuilt and got your error.
    I will connect to work and get my source project and see what the root namespace is.

    Hold on....
    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 PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI 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

  16. #16

    Thread Starter
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428

    Re: vs 2003 and outlook?

    Quote Originally Posted by RobDog888
    Ok, I pasted in my code into an existing Outlook test project and rebuilt and got your error.
    I will connect to work and get my source project and see what the root namespace is.

    Hold on....
    thanks
    I'm not in a hurry though, so take your time... I'll probably have to wait till the weekend
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  17. #17
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: vs 2003 and outlook?

    Ok, this must be some weird .NET thing now. .Interop is not showing on my home system, but it does for
    my work system. Both are the same versions and Office versions. Only difference is my work system is
    XP SP2 and home is XP SP1.
    Attached Images Attached Images  
    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 PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI 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

  18. #18
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: vs 2003 and outlook?

    Quote Originally Posted by MrPolite
    thanks
    I'm not in a hurry though, so take your time... I'll probably have to wait till the weekend
    What happened to Wednesday, Thursday, and Friday? I want to work where you work. 5 day weekends!

    Ok, I'll check more into it tomorrow at work.
    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 PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI 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

  19. #19
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: vs 2003 and outlook?

    Ok, got it working but still cant explain the .Interop issue.
    VB Code:
    1. Imports Microsoft.Office
    2. '...
    3. '...
    4.  
    5.     Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    6.         mbTerminate = False
    7.         Try
    8.             moApp = GetObject(, "Outlook.Application")
    9.         Catch ex As Exception
    10.             If moApp Is Nothing Then
    11.                 moApp = New Outlook.Application
    12.                 mbTerminate = True
    13.             End If
    14.         End Try
    15.         moNS = moApp.GetNamespace("MAPI")
    16.     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 PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI 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

  20. #20

    Thread Starter
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428

    Re: vs 2003 and outlook?

    w00t it's working!! unbelievable hah
    p.s. I didnt even need Office.Interop. It compiled without it!

    one thing, every time I do this outlook asks me whether I should allow the program to access the data or not. Is there a way to stop that?
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  21. #21
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: vs 2003 and outlook?

    's

    But you used the "Imports Microsoft.Office" though?

    You can stop the Outlook Security Prompt by re-writing your app as an Trusted Outlook Add-In using the
    IDExtensibility2 implements (usually a pain).

    With .NET I do believe there is another option, but I cant remember right now. I vaguely remember reading
    something about new VS.NET features/capabilities. I havent got too deep into .NET and Office yet.
    Not much time lately.
    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 PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI 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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width