473,890 Members | 2,061 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Reading the Exchange GAL from asp.net page

Hi.

I am trying to read addresses from an Exchange 5.5 Global
Address Book from an asp.net page. When the page executes
the error "Collaborat ion Data Objects - [E_FAIL
(80004005)]]" is generated.

Here is the code:

Dim strProfileInfo As String
Dim ObjSession As New MAPI.Session
Dim objAddressListT ype As New
MAPI.CdoAddress ListTypes
Dim objAddressList As New Object
Dim objAddressEntry As New Object

Dim strServer As String = "" - valid server
name here
Dim strMailbox As String = "" - valid mailbox
here
strProfileInfo = strServer & vbLf & strMailbox
ObjSession.Logo n(, , False, True, , True,
strProfileInfo)

objAddressList = ObjSession.GetA ddressList
(objAddressList Type.CdoAddress ListGAL)

'list all addresses in the gal
For Each objAddressEntry In objAddressList
Response.Write( objAddressEntry .Address())
Next

The ObjSession.GetA ddressList method call is the line
that generates the error.

We are running Exchange 5.5. I am using CDO version
1.21. The web server and the exchange server are two
different machines. The web server, which is my localhost
for now, is running XP.

I would be thankfull for any help.

Thanks.

Jeff

Jul 21 '05 #1
7 10592
Hi Jeff,

You may have a test with the steps below.
1) open a new ASP file.

2) Cut and paste the following code in it.

3) Modify the serve r name and Profile name to reflect your own. ( place
where to change is in red and bold )

4) Change the recepient name to your own. ( place where to change is in red
and bold )

5) Save file as testmail.asp

Load file in browser and try it.

------------------------------------CODE
BEGIN----------------------------------

<%@ LANGUAGE="VBSCR IPT" %>

<%

Fetch = Request.Form.It em("Fetch")

if Fetch = "Fetch" then

Set objSession = CreateObject("M API.Session")

bstrServer = "YourServerName "

bstrMailbox = "YourProfileNam e"

bstrProfileInfo = bstrServer + vbLf + bstrMailbox

objSession.Logo n , , , false, , true, bstrProfileInfo

' create a message and fill in its properties

Set objMessage = objSession.Outb ox.Messages.Add

objMessage.Subj ect = "test message"

objMessage.Text = "test message"

' create the recipient

Set objOneRecip = objMessage.Reci pients.Add

objOneRecip.Nam e = "YourName" ' example Rohit Puri if I was sending it to
myself

objOneRecip.Res olve ' get MAPI to determine complete e-mail address

' send the message and log off

objMessage.Send showDialog=fals e

objSession.Logo ff

set objSession = nothing

set objMessage = nothing

set objOneRecip = nothing

end if

%>

<html>

<body>

<form action="testmai l.asp" method="post" id=form>

<input id="Fetch" name="Fetch" type="submit" value="Fetch">

</p>

</form>

</body>

</html>

Please have a test and let me know the result.
What is the authentication in the IIS you are using, if it is the windows
intergrated authentication, try to change it into basic authentication.
Regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

--------------------
Content-Class: urn:content-classes:message
From: "jeff" <je********@inf armbureau.com>
Sender: "jeff" <je********@inf armbureau.com>
Subject: Reading the Exchange GAL from asp.net page
Date: Tue, 7 Oct 2003 12:30:39 -0700
Lines: 48
Message-ID: <03************ *************** *@phx.gbl>
MIME-Version: 1.0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
X-Newsreader: Microsoft CDO for Windows 2000
Thread-Index: AcONCX1uvF5A55y +Rn+WDMBKFVcCQw ==
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
Newsgroups: microsoft.publi c.dotnet.genera l
Path: cpmsftngxa06.ph x.gbl
Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.genera l:111091
NNTP-Posting-Host: TK2MSFTNGXA12 10.40.1.164
X-Tomcat-NG: microsoft.publi c.dotnet.genera l

Hi.

I am trying to read addresses from an Exchange 5.5 Global
Address Book from an asp.net page. When the page executes
the error "Collaborat ion Data Objects - [E_FAIL
(80004005)]]" is generated.

Here is the code:

Dim strProfileInfo As String
Dim ObjSession As New MAPI.Session
Dim objAddressListT ype As New
MAPI.CdoAddres sListTypes
Dim objAddressList As New Object
Dim objAddressEntry As New Object

Dim strServer As String = "" - valid server
name here
Dim strMailbox As String = "" - valid mailbox
here
strProfileInfo = strServer & vbLf & strMailbox
ObjSession.Logo n(, , False, True, , True,
strProfileInfo )

objAddressList = ObjSession.GetA ddressList
(objAddressLis tType.CdoAddres sListGAL)

'list all addresses in the gal
For Each objAddressEntry In objAddressList
Response.Write( objAddressEntry .Address())
Next

The ObjSession.GetA ddressList method call is the line
that generates the error.

We are running Exchange 5.5. I am using CDO version
1.21. The web server and the exchange server are two
different machines. The web server, which is my localhost
for now, is running XP.

I would be thankfull for any help.

Thanks.

Jeff


Jul 21 '05 #2

Hi Peter.

I created a asp page with the test code you sent me.

When I run the code I get the folling error:

Collaboration Data Objects (0x4F7)
[Collaboration Data Objects - [MAPI_E_NOT_FOUN D(8004010F)]]

The error occurs on the line:

objSession.Logo n , , , false, , true, bstrProfileInfo

I have verified that the server and mailbox are valid.

I also tried the page with both Integrated and Basic security.

I guess this is telling me it can not get logged on to the server?

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 21 '05 #3
Hi Jeff,


But I think we may focus on back to the original problem you encounter in
the first post.

I can not reproduce the problem.
I tested your code and modified as below.
Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button1.Click
Dim strProfileInfo As String
Dim ObjSession As New MAPI.Session
Dim objAddressListT ype As New MAPI.CdoAddress ListTypes
Dim objAddressList As MAPI.AddressLis t
Dim objAddressEntry As MAPI.AddressEnt ry
Dim strServer As String = "" ' valid server name(here)
Dim strMailbox As String = "" ' valid mailbox here()
strProfileInfo = strServer & vbLf & strMailbox
ObjSession.Logo n(, , False, True, , True, strProfileInfo)
objAddressList =
CType(ObjSessio n.GetAddressLis t(objAddressLis tType.CdoAddres sListGAL),
MAPI.AddressLis t)
'list all addresses in the gal
For Each objAddressEntry In objAddressList. AddressEntries
Response.Write( objAddressEntry .Address())
Exit For
Next
End Sub
End Class

Do you have outlook? If yes, you may try to use the outlook to connect to
the exchange server with the same problem you use in the code above to see
if you can access the Global Address List?

When I run the code I get the folling error:

Collaboratio n Data Objects (0x4F7)
[Collaboration Data Objects - [MAPI_E_NOT_FOUN D(8004010F)]] There are many possible to cause the problem, you can seach the error in
google with many result.
e.g.PRB: CDO:"MAPI_E_NOT _FOUND" Error When You Call Session.Logon
http://support.microsoft.com/?id=254567
I let you try the code just to ensure if the problem is about the IIS
authentication issue.

I look forward to hearing from you.
Regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

--------------------From: jeff rhoad <je********@inf armbureau.com>
References: <zy************ **@cpmsftngxa06 .phx.gbl>
X-Newsreader: AspNNTP 1.50 (ActionJackson. com)
Subject: RE: Reading the Exchange GAL from asp.net page
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Message-ID: <ef************ **@TK2MSFTNGP10 .phx.gbl>
Newsgroups: microsoft.publi c.dotnet.genera l
Date: Wed, 08 Oct 2003 08:24:06 -0700
NNTP-Posting-Host: actionjackson13 3.dsl.frii.net 216.17.147.133
Lines: 1
Path: cpmsftngxa06.ph x.gbl!TK2MSFTNG P08.phx.gbl!TK2 MSFTNGP10.phx.g bl
Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.genera l:111174
X-Tomcat-NG: microsoft.publi c.dotnet.genera l
Hi Peter.

I created a asp page with the test code you sent me.

When I run the code I get the folling error:

Collaboratio n Data Objects (0x4F7)
[Collaboration Data Objects - [MAPI_E_NOT_FOUN D(8004010F)]]

The error occurs on the line:

objSession.Log on , , , false, , true, bstrProfileInfo

I have verified that the server and mailbox are valid.

I also tried the page with both Integrated and Basic security.

I guess this is telling me it can not get logged on to the server?

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


Jul 21 '05 #4
Hi, Jeff

With Peter's concurrence I've created an escalation with the messaging
team. You should receive a response from them by close of business on
Friday, Pacific time. If you do not, please respond here or send me an
email (remove online. from my alias) and I will expedite.

Thank you for choosing the MSDN Managed Newsgroups,

John Eikanger
Microsoft Developer Support

This posting is provided “AS IS” with no warranties, and confers no rights.
"Microsoft highly recommends to all of our customers that they visit the
http://www.microsoft.com/protect site and perform the three straightforward
steps listed to improve your computer’s security."
--------------------
| From: jeff rhoad <je********@inf armbureau.com>
| References: <zy************ **@cpmsftngxa06 .phx.gbl>
| X-Newsreader: AspNNTP 1.50 (ActionJackson. com)
| Subject: RE: Reading the Exchange GAL from asp.net page
| Mime-Version: 1.0
| Content-Type: text/plain; charset="us-ascii"
| Content-Transfer-Encoding: 7bit
| Message-ID: <ef************ **@TK2MSFTNGP10 .phx.gbl>
| Newsgroups: microsoft.publi c.dotnet.genera l
| Date: Wed, 08 Oct 2003 08:24:06 -0700
| NNTP-Posting-Host: actionjackson13 3.dsl.frii.net 216.17.147.133
| Lines: 1
| Path: cpmsftngxa06.ph x.gbl!TK2MSFTNG P08.phx.gbl!TK2 MSFTNGP10.phx.g bl
| Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.genera l:111174
| X-Tomcat-NG: microsoft.publi c.dotnet.genera l
|
|
| Hi Peter.
|
| I created a asp page with the test code you sent me.
|
| When I run the code I get the folling error:
|
| Collaboration Data Objects (0x4F7)
| [Collaboration Data Objects - [MAPI_E_NOT_FOUN D(8004010F)]]
|
| The error occurs on the line:
|
| objSession.Logo n , , , false, , true, bstrProfileInfo
|
| I have verified that the server and mailbox are valid.
|
| I also tried the page with both Integrated and Basic security.
|
| I guess this is telling me it can not get logged on to the server?
|
|
|
| *** Sent via Developersdex http://www.developersdex.com ***
| Don't just participate in USENET...get rewarded for it!
|

Jul 21 '05 #5
We are trying to find the best resource on the messaging team to handle this one.

They will post a response as soon as we find a resource.

Sincerely,
Max Vaughn [MS]
Microsoft Developer Support
Disclaimer: This posting is provided "AS IS" with no warranties, and confers no rights. You assume all risk for your use.

Jul 21 '05 #6


Just to bring everyone up to speed on what is going on I used the
updated code peter sent me and ran another test from my asp.net web
page. I still get the following error:

[Collaboration Data Objects - [E_FAIL(80004005 )]]

after the GetAddressList method call.

Here is an updated look at my code:

Dim strProfileInfo As String
Dim ObjSession As New MAPI.Session
Dim objAddressListT ype As New MAPI.CdoAddress ListTypes
Dim objAddressList As MAPI.AddressLis t

Dim objAddressEntry As MAPI.AddressEnt ry

Dim strServer As String = "valid exchange server"
Dim strMailbox As String = "valid alias"
strProfileInfo = strServer & vbLf & strMailbox
ObjSession.Logo n(, , False, True, , True, strProfileInfo)
objAddressEntry = ObjSession.Curr entUser
Dim address = objAddressEntry .Address()
Dim name = objAddressEntry .Name()
objAddressList =
CType(ObjSessio n.GetAddressLis t(objAddressLis tType.CdoAddres sListGAL),
MAPI.AddressLis t) '0 = gal

'list all addresses in the gal
For Each objAddressEntry In objAddressList. AddressEntries
Response.Write( objAddressEntry .Address())
Next
I query the name and address property of the AddressEntry object after
the logon method call and the value is "unknown" for both address and
name. I guess this means I can not get logged on to exchange but I am
pretty sure the server name and alias are valid. However, I will verify
that.

Also, I ran this code with basic security on and Integrated Security
off, and Basic Security off and Integrated security on and I got the
error both times.

Thanks.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 21 '05 #7
Jeff,

There are a couple of things that I can suggest for this problem. First
have you seen this article that outlines the usage of the CDO 1.21 library
in the

813349 Support Policy for Microsoft Exchange APIs with .NET Framework
http://support.microsoft.com/?id=813349

Also with CDO 1.21 we also encounter the following limitation even without
.Net in the picture:

247288 PRB: CDO Applications Are Not Supported in MTS or COM+
http://support.microsoft.com/?id=247288

One thing that you could try is using the ASPCOMPAT switch in your ASP
page. This make the page run in a single threaded manner:
308095 PRB: Creating STA Components in the Constructor in ASP.NET ASPCOMPAT
http://support.microsoft.com/?id=308095

So your options would be:
Try using the option above, but still be in a unsupported environment (CDO and .Net) Use CDO code in ASP and not ASP.Net
You could also use ADSI to do this, I've included some examples below for

your reference:
300121 How to Programmaticall y Create a GAL in Exchange 2000 Server
http://support.microsoft.com/?id=300121

241474 HOWTO: Render the Global Address List with ADSI
http://support.microsoft.com/?id=241474

I hope this helps!

- Jeff
Developer Support - Messaging
Microsoft

Jul 21 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1834
by: Jim in Arizona | last post by:
I have no idea how to get started, really, but I am looking for a way to have an email sent via an ASP page via our Exchange 2000 server. I have a fairly simple asp page that displays data from a SQL 2000 database in the form of web links. A part of this page allows people to post links to the database for display. When someone posts a link, I would like an email sent to me with the data (link) that they posted through the ASP page. ...
0
1396
by: Jayme | last post by:
My company would like to implement an online calendar that integrates with our current website that would allow our clients to view upcoming workshops and events. These "appointments" are currently entered by the event coordinators into a public calendar on our Exchange 2000 server. Our Exchange 2000 server and our Internet server exist on two different machines and a solution cannot consist of a "server" program that resides on the...
3
2092
by: Curt_C [MVP] | last post by:
Hey all, I can't seem to find a good link to reading an Exchange (2000) calendar with ASP.NET 1.1 Anyone got a good pointer/starter/link? Thanks -- Curt Christianson site: http://www.darkfalz.com
1
3719
by: Andrew Gomes | last post by:
Does anyone know if there is an alternative to reading Exchange 2003 public folders with WMI? I am using WMI in VB.NET to read a list of public folders on an Exchange 2003 server. My problem is that it is INCREDIBLY slow!!! It seems to reads in chunks from the server with a long delay between "chunks." The other problem is that the server has over 60,000 public folders! (So you can imagine how long this takes!) Is there an...
7
544
by: jeff | last post by:
Hi. I am trying to read addresses from an Exchange 5.5 Global Address Book from an asp.net page. When the page executes the error "Collaboration Data Objects - ]" is generated. Here is the code: Dim strProfileInfo As String Dim ObjSession As New MAPI.Session
0
3615
by: rnaimon | last post by:
I found the following information on this site, but I am unable to get it to work. All it brings back is the xml page with no data. I am running a Windows 2003 Server with Exchange 2003 Server. When the code gets to This line.. If objDoc.loadXml(objRequest.ResponseText) Then The results return False and I don't receive any data. Does anyone know what the problem may be? Re: ASP: Exchange 2003 Free/Busy Lookup ...
0
3404
by: arjen1984 | last post by:
I am now working on C# with WebDAV on Exchange now to get appointments. When I work local on the domain where the server is, i can get the appointments no problem. When I work outside of it, i get an SecurityException. This is my code to get the appointments: protected void getAfspraken() { NetworkCredential credential = new NetworkCredential("bhees","1234567", "oaicttest"); WebdavSession session = new...
1
1951
by: ouistyty | last post by:
Hi We have a simple asp page that query LDAP attribrute. Everithing is working fine using a native domain account. but when using an external account we have an error 70, acces denie. Here's some basic info on our structure. - Domain/Forest A with Exchange - Domain/Forest B with external accounts. - Forest A Trus Forest B and "Vice Versa" - asp page on a Exchange FrontEnd server on default web site (same as
2
2397
by: adam.waterfield | last post by:
Maybe someone could help me a little here. On a project I am working on, we have some LDAP authentication to Active Directory which allows users to login to our application - this is fine. When accessing this application from off campus, they routinely get this login window confused with the one they login to Exchange Sever with for their email. I am wondering if it is possible to setup some kind of button/link that is displayed after...
0
9978
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9822
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10819
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10923
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9633
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
8016
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7169
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5851
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4676
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.