How to send email from VB 2015 using Outlook?

I am trying to send e-mail from a 2015 VB app and am having trouble.  I have basically copied code from the MSDN web site for VB 2013 and later.  I could not find 2015 specific code.

The problem I have is  .CreateItem nor .Session are members of Application.  I fell like I have left something out, but not sure what.

I have added as references Microsoft Office 10. Object Library and Microsoft Outlook 15.0 Object Library.
I have included the import in my project.
   Imports Outlook = Microsoft.Office.Interop.Outlook



    
Private Sub SendSalesReport()
        Dim mail As Outlook.MailItem = CType(Application.CreateItem(
            Outlook.OlItemType.olMailItem), Outlook.MailItem)
        mail.Subject = "Quarterly Sales Report FY06 Q4"
        Dim currentUser As Outlook.AddressEntry =
            Application.Session.CurrentUser.AddressEntry
        If currentUser.Type = "EX" Then
            Dim manager As Outlook.ExchangeUser =
                currentUser.GetExchangeUser().GetExchangeUserManager()
            ' Add recipient using display name, alias, or smtp address
            mail.Recipients.Add(manager.PrimarySmtpAddress)
            mail.Recipients.ResolveAll()
            mail.Send()
        End If
    End Sub

Open in new window

JeffMCCAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Éric MoreauSenior .Net ConsultantCommented:
Najam UddinCommented:
Try changing Application to Outlook.Application
JeffMCCAuthor Commented:
@Najam,

I tried changing to Outlook.Application.  I now get Reference to non-shared member requires an object reference.
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

JeffMCCAuthor Commented:
@Eric,

I'll take a look at that, but was hoping to get this method working.

Thanks
Najam UddinCommented:
That issue that solved by making
Private Sub SendSalesReport() 

Open in new window

to
Public Shared Sub SendSalesReport()

Open in new window

ktaczalaCommented:
add: Dim AppOutlook as New Outlook.Application
then change your 2 lines of code to this:
Dim mail As Outlook.MailItem = CType(AppOutlook .CreateItem(
            Outlook.OlItemType.olMailItem), Outlook.MailItem)

Dim currentUser As Outlook.AddressEntry =
            AppOutlook .Session.CurrentUser.AddressEntry

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
JeffMCCAuthor Commented:
@Najam,

That still did not work.  Same message.

@ktaczala,

That worked.  Thanks
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Outlook

From novice to tech pro — start learning today.