Checking if user has Outlook and then...

I have an app that collects email addresses. I want the user to be able to select the email addresses they want and then push them into the Outlook BCC field. I have no idea where to even start with this...

Basically, I just need to know how to check if a user has outlook on their system... and how to put items to the BCC field if they do.

I've already taken care of the string of email addresses...

Thank you
md0333Asked:
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.

Bill NolanOwner, Lead Technology ProgrammerCommented:
I haven't checked this out myself but look into MS Outlook command line parameters.
0
the_oCommented:
Hey
Try this

        Try
            Dim TheApp As String = "Outlook.Application"
            '"word.application"
            '"excel.application"
            '"access.application"
            '"SomeProgram.ApplicationType"

            Dim oApp As Object = CreateObject(TheApp)
            bInstalled = True
        Catch
            bInstalled = False
            MessageBox.Show("Office Application not installed!", "Office Installed", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
        End Try

Open in new window

Try
            Dim TheApp As String = "Outlook.Application"
            '"word.application"
            '"excel.application"
            '"access.application"
            '"SomeProgram.ApplicationType"

            Dim oApp As Object = CreateObject(TheApp)
            bInstalled = True
        Catch
            bInstalled = False
            MessageBox.Show("Office Application not installed!", "Office Installed", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
        End Try

Open in new window

0
md0333Author Commented:
OK... so that takes care of the "check if user has outlook installed"

I ran that and it passed... I'm guessing it's correct since my computer has outlook. So now to the second part... how do I build an outlook object and put my string of email addresses in the BCC field? The user will add there own subject and body content to the message. Please include any "imports" or references I need to make or put on my page.

Thank you
0
Exploring ASP.NET Core: Fundamentals

Learn to build web apps and services, IoT apps, and mobile backends by covering the fundamentals of ASP.NET Core and  exploring the core foundations for app libraries.

the_oCommented:
Hey
First right click your project and select Add Reference
Under .NET tab select Microsoft.Office.Interop.Outlook v11.0.0.0

in your form or class add
Imports Microsoft.Office.Interop

Please note that I did not have time to test this as I am on my way out of the office, but it should be working as is with a couple of tweaks to the TODO comments.

Please remember to mark as Answer when done
Private Sub EmailTest()
        ' Create an Outlook application object instance.
        Dim oApp As Outlook._Application
        oApp = New Outlook.Application()

        ' Create a new MailItem.
        Dim oMsg As Outlook._MailItem
        oMsg = oApp.CreateItem(Outlook.OlItemType.olMailItem)

        ' TODO: Clear this if you want a blank subject line in the email
        oMsg.Subject = "Send Attachment Using OOM in Visual Basic .NET"

        ' TODO: Clear this if you want a blank body in the email
        oMsg.Body = "Hello World" & vbCr & vbCr

        ' TODO: Replace with a valid e-mail address.
        oMsg.To = "user@example.com"
        oMsg.CC = "someone@someplace.com"
        oMsg.BCC = "someoneElse@nowhere.com"

        ' Add an attachment
        ' TODO: Replace with a valid attachment path.
        Dim sSource As String = "C:\Temp\Hello.txt"
        ' TODO: Replace with attachment name
        Dim sDisplayName As String = "Hello.txt"

        Dim sBodyLen As String = oMsg.Body.Length
        Dim oAttachs As Outlook.Attachments = oMsg.Attachments
        Dim oAttach As Outlook.Attachment
        oAttach = oAttachs.Add(sSource, , sBodyLen + 1, sDisplayName)

        ' Send
        oMsg.Send()

        ' Clean up
        oApp = Nothing
        oMsg = Nothing
        oAttach = Nothing
        oAttachs = Nothing
    End Sub

Open in new window

0

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
md0333Author Commented:

the_o:
Looks good... tested and worked well on my machine. My concern is that my reference version is 12.0. (I didn't see 11.0) What if a user has an older version of Outlook? Some of our clients may have versions of Outlook that are 7-8 years old. Is this backwards compatible? Or, do I need to add references to older versions? And if so, do I need to change the code at all?
0
md0333Author Commented:
... I'm being told that this code does not use the Users outlook but the servers...

I'm trying to check for the user of the web app. Is that what this code is doing? Or, is it looking at the server since this is being done in code behinde?
0
md0333Author Commented:
I realized the answer I got was correct for what I asked for (I never mentioned it was a web app) so I will award points.

What I ended up doing is below and seems to be working perfect so far.

            function InsertMailToTag() {

                var emailstring = getEmails();
                
                emailWindow = window.open("about:blank", "a", "width=400,height=200,menubar=no,toolbar=no, status=no, location=no");
                with (emailWindow.document) {
  
                    writeln('<html><head><title>FI-Traxx</title><scr' + 'ipt>self.focus();self.moveTo(200,200);</scr' + 'ipt></head>');
                    writeln('<body bgcolor=#202020 link=#74ac42 vlink=#df7e2a alink=#df7e2a>');
                    writeln('<font face=Arial size=2 color=#ffffff>');
                    writeln('<IMG SRC="Images/fitraxxsplashdkBGMedium.png" WIDTH="170" BORDER="0" HEIGHT="47" HSPACE="10" VSPACE="5" ALIGN=left></IMG>');
                    writeln('<br><br><br><br>Click on the link below to add the selected Email addresses.<br><br>');
                    writeln("<a href='mailto:?bcc=" + emailstring + "'>FI-Traxx: Create Email Campaign</A>");
                    writeln('</font>');
                    writeln('</body></html>');
                }

            }

            function getEmails() {

                var grid = $find("<%=RadGrid1.ClientID %>");
                var MasterTable = grid.get_masterTableView();
                var email;

                var selectedRows = MasterTable.get_selectedItems();
                for (var i = 0; i < selectedRows.length; i++) {
                    var row = selectedRows[i];
                    var cell = MasterTable.getCellByColumnUniqueName(row, "Email")
                    if (i == 0)
                        email = cell.innerHTML
                    else
                        email += ";" + cell.innerHTML
                }

                return email;

            }

Open in new window

0
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
.NET Programming

From novice to tech pro — start learning today.