URGENT!!!!!!!!!!!!!!!!! Accessing MS Outlook Address book using asp.net

G

Guest

Hi

I have a webform in whihc ther is button . when i click on
button i am displaying all the email address in the
outlook. it is working fine when i try to acess webpage in
mycomputer.

Private Sub CallOutlookAddressBook()
Dim OLApp As New Outlook.Application()
'Creating Outlook Namespace object to Access MAPI
name space
Dim OLNameSpace As Outlook.NameSpace
'Declaring variable to access MAPIFOLDER
Dim allcontacts As Outlook.MAPIFolder
'
OLNameSpace = OLApp.GetNamespace("MAPI")
'Getting outlook contacts folder and setting up
reference to allcontacts
allcontacts = OLNameSpace.GetDefaultFolder
(Outlook.OlDefaultFolders.olFolderContacts)
'sorting the contacts by company name
allcontacts.Items.Sort("Email1Address")
'creating contact variable item for iteration
Dim contact As Outlook.ContactItem
'count
Dim cnt As Integer
'Iterating to the allcontacts items collection
For cnt = 1 To allcontacts.Items.Count
contact = allcontacts.Items.Item(cnt)
'if company name is not empty then write
company name on console.
'later on you cna load the companynames to a
listbox or listview.
If cnt > 10 Then
Exit For
End If
If contact.Email1Address <> "" Then
'writing the company name to console
'Console.WriteLine(contact.Email1Address)
lblMessage.Text = lblMessage.Text & "," &
contact.Email1Address
End If
Next
End Sub

1)WHen i install this application in different system and
run the webpage it gives me error at this line.

"Dim OLNameSpace As Outlook.NameSpace"

2)and when i try to access this webpage from different
computer with out installing it give me an error

" custom errors = off"

can anyone know what it is and why i am geting this error
and any solutions to those

Thanks in advance
sireesha

..
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top