Solved

Outlook / VB.net A program is trying to access e-mail addresses.

Posted on 2011-09-15
6
285 Views
Last Modified: 2012-05-12
Hello all

I have created a code where i extract my contact list from Microsoft Outlook 2007 with vb.net.

Everything is working gret but only for one thing that is not.

Everytime that i open this code, in outlook, i have a message where it tells me that A program is trying to access e-mail addresses.

Is there a way to ALLOW it automatically for this vb.net project?

Thanks again for your help



  Dim intRowNum As Integer

        Dim objXL As Excel.Application
        Dim objWkb As Excel.Workbook
        Dim objSht As Excel.Worksheet


        Dim oApp As Outlook.Application = New Outlook.Application()
        Dim oNS As Outlook.NameSpace = oApp.GetNamespace("mapi")
        oNS.Logon("Outlook", Missing.Value, False, True) ' TODO:

        Dim cContacts As Outlook.MAPIFolder = oNS.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderContacts)
        Dim oItems As Outlook.Items = cContacts.Items


        

        '--- set a reference to Excel
        objXL = New Excel.Application
        '--- create the workbook
        objWkb = objXL.Workbooks.Add
        '--- set a reference to the sheet
        objSht = objWkb.ActiveSheet


        'Write Column Headings
        objSht.Cells(1, 1) = "Nom du Client"
        objSht.Cells(1, 2) = "Adresse"
        objSht.Cells(1, 3) = "Ville"
        objSht.Cells(1, 4) = "Code Postal"
        objSht.Cells(1, 5) = "Téléphone"
        objSht.Cells(1, 6) = "Cellulaire"
        objSht.Cells(1, 7) = "Courriel"


        objSht.Range("A1").Select()


        objSht.Cells(1, 1).Font.Bold = True
        objSht.Cells(1, 1).Font.Underline = True

        objSht.Cells(1, 2).Font.Bold = True
        objSht.Cells(1, 2).Font.Underline = True

        objSht.Cells(1, 3).Font.Bold = True
        objSht.Cells(1, 3).Font.Underline = True

        objSht.Cells(1, 4).Font.Bold = True
        objSht.Cells(1, 4).Font.Underline = True

        objSht.Cells(1, 5).Font.Bold = True
        objSht.Cells(1, 5).Font.Underline = True

        objSht.Cells(1, 6).Font.Bold = True
        objSht.Cells(1, 6).Font.Underline = True

        objSht.Cells(1, 7).Font.Bold = True
        objSht.Cells(1, 7).Font.Underline = True

        intRowNum = 2

        For Each oItem In oItems
            objSht.Cells(intRowNum, 1) = oItem.FullName
            objSht.Cells(intRowNum, 2) = oItem.HomeAddressStreet
            objSht.Cells(intRowNum, 3) = oItem.HomeAddressCity
            objSht.Cells(intRowNum, 4) = oItem.HomeAddressPostalCode
            objSht.Cells(intRowNum, 5) = oItem.HomeTelephoneNumber
            objSht.Cells(intRowNum, 6) = oItem.MobileTelephoneNumber
            objSht.Cells(intRowNum, 7) = oItem.Email1Address

            intRowNum = intRowNum + 1
        Next oItem


        
        Dim strDate As String

        strDate = Format(Now, "yyyy-mm-dd_hhmm")

        objSht.SaveAs("C:\Users\Jean-Marc\Desktop\Sauvegarde des contacts" & " - " & strDate & ".xls")
        objXL.Quit()

        MsgBox("Sauvegarde des contact Microsoft Outlook terminé")

Open in new window

Outlook2007-prompt1.png
0
Comment
Question by:Wilder1626
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 40

Accepted Solution

by:
Jacques Bourgeois (James Burger) earned 500 total points
ID: 36544413
I do not get this message.

The icon in the message you receive looks a security icon, but it is not one that comes from Windows. I suspect that your anti-virus is blocking the access. Check your anti-virus checkings and/or its documentation to see how to correct that.

If you allow access, do you have something such as "Always" or "This program is secure" in the drop down list?

If I am right and if the application is to be used on many computers that use the same antivirus program, you will have to do the same on all of them.
0
 
LVL 11

Author Comment

by:Wilder1626
ID: 36544584
Hello JamesBurger

My Anti-Virus is off for now. But i still get that box. It look's like windows security or outlook security.

In the ALLOW access for option, i only only have from 1 minutes to 15 minutes. i dont have the Always option.

I will look at the Outlook security option, see if i found something.
0
 
LVL 40
ID: 36544790
I have never seen an icon like the one you get from Windows or Outlook. Similar ones yes, but like this one no.

The icon is fuzzy. Unless it is an artefact of the .png, it does not look like something that would come from Microsoft.

If you click the Help button in the MessageBox, where does it leads to?
0
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 
LVL 40
ID: 36544826
Oups. Sent the last one too fast, hit the wrong button while I was searching for extra info.

Still puzzled about the fuzzy icon, but this message could indeed be sent by Outlook. See here.
0
 
LVL 11

Author Comment

by:Wilder1626
ID: 36545225
Do you know what?

I have put back the antivirus and i also did an update and i don't see the icon.

Everything is ok now.
0
 
LVL 11

Author Closing Comment

by:Wilder1626
ID: 36546533
Thanks again, everything works now.

It was a anti-virus update to do.

Thanks again.
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
location of a form 2 33
Passing data between Forms 3 29
vb.net sendkey 4 19
Images showing on the internet -- asp.net -- VB.net.  Why some do and some don’t. 3 26
This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question