473,396 Members | 1,805 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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 "Collaboration Data Objects - [E_FAIL
(80004005)]]" is generated.

Here is the code:

Dim strProfileInfo As String
Dim ObjSession As New MAPI.Session
Dim objAddressListType As New
MAPI.CdoAddressListTypes
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.Logon(, , False, True, , True,
strProfileInfo)

objAddressList = ObjSession.GetAddressList
(objAddressListType.CdoAddressListGAL)

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

The ObjSession.GetAddressList 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 10560
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="VBSCRIPT" %>

<%

Fetch = Request.Form.Item("Fetch")

if Fetch = "Fetch" then

Set objSession = CreateObject("MAPI.Session")

bstrServer = "YourServerName"

bstrMailbox = "YourProfileName"

bstrProfileInfo = bstrServer + vbLf + bstrMailbox

objSession.Logon , , , false, , true, bstrProfileInfo

' create a message and fill in its properties

Set objMessage = objSession.Outbox.Messages.Add

objMessage.Subject = "test message"

objMessage.Text = "test message"

' create the recipient

Set objOneRecip = objMessage.Recipients.Add

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

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

' send the message and log off

objMessage.Send showDialog=false

objSession.Logoff

set objSession = nothing

set objMessage = nothing

set objOneRecip = nothing

end if

%>

<html>

<body>

<form action="testmail.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********@infarmbureau.com>
Sender: "jeff" <je********@infarmbureau.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.public.dotnet.general
Path: cpmsftngxa06.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.general:111091
NNTP-Posting-Host: TK2MSFTNGXA12 10.40.1.164
X-Tomcat-NG: microsoft.public.dotnet.general

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 - [E_FAIL
(80004005)]]" is generated.

Here is the code:

Dim strProfileInfo As String
Dim ObjSession As New MAPI.Session
Dim objAddressListType As New
MAPI.CdoAddressListTypes
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.Logon(, , False, True, , True,
strProfileInfo)

objAddressList = ObjSession.GetAddressList
(objAddressListType.CdoAddressListGAL)

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

The ObjSession.GetAddressList 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_FOUND(8004010F)]]

The error occurs on the line:

objSession.Logon , , , 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(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim strProfileInfo As String
Dim ObjSession As New MAPI.Session
Dim objAddressListType As New MAPI.CdoAddressListTypes
Dim objAddressList As MAPI.AddressList
Dim objAddressEntry As MAPI.AddressEntry
Dim strServer As String = "" ' valid server name(here)
Dim strMailbox As String = "" ' valid mailbox here()
strProfileInfo = strServer & vbLf & strMailbox
ObjSession.Logon(, , False, True, , True, strProfileInfo)
objAddressList =
CType(ObjSession.GetAddressList(objAddressListType .CdoAddressListGAL),
MAPI.AddressList)
'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:

Collaboration Data Objects (0x4F7)
[Collaboration Data Objects - [MAPI_E_NOT_FOUND(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********@infarmbureau.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.public.dotnet.general
Date: Wed, 08 Oct 2003 08:24:06 -0700
NNTP-Posting-Host: actionjackson133.dsl.frii.net 216.17.147.133
Lines: 1
Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTN GP10.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.general:111174
X-Tomcat-NG: microsoft.public.dotnet.general
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_FOUND(8004010F)]]

The error occurs on the line:

objSession.Logon , , , 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********@infarmbureau.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.public.dotnet.general
| Date: Wed, 08 Oct 2003 08:24:06 -0700
| NNTP-Posting-Host: actionjackson133.dsl.frii.net 216.17.147.133
| Lines: 1
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTN GP10.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.general:111174
| X-Tomcat-NG: microsoft.public.dotnet.general
|
|
| 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_FOUND(8004010F)]]
|
| The error occurs on the line:
|
| objSession.Logon , , , 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 objAddressListType As New MAPI.CdoAddressListTypes
Dim objAddressList As MAPI.AddressList

Dim objAddressEntry As MAPI.AddressEntry

Dim strServer As String = "valid exchange server"
Dim strMailbox As String = "valid alias"
strProfileInfo = strServer & vbLf & strMailbox
ObjSession.Logon(, , False, True, , True, strProfileInfo)
objAddressEntry = ObjSession.CurrentUser
Dim address = objAddressEntry.Address()
Dim name = objAddressEntry.Name()
objAddressList =
CType(ObjSession.GetAddressList(objAddressListType .CdoAddressListGAL),
MAPI.AddressList) '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 Programmatically 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
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...
0
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...
3
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:...
1
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...
7
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...
0
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. ...
0
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...
1
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...
2
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
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,...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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,...

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.