473,386 Members | 1,757 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,386 software developers and data experts.

Getting Global Contacts from Exchange


Environment
C#, Asp.Net 2.0, Windows 2000 Server
Problem
I'm trying to enumerate all the names in the global contacts on the exchange
server using CDO / ADO / (whatever I can).
In writing an ASP.Net support ticket application, I want to populate the
list of "Who reported this ticket" with names from the global contacts.
An extension of this would then be to allow the user to add a person to the
global contact via the web page, should they not exist in the contacts list.

To start with, I'm writing a basic windows application with one textbox as
the input providing the URL to get the contacts from, and one text box as
the output to put any contacts names I find into. I compile this application
then try to run it on the exchange server, but get an error saying the
"Bookmark is invalid" the first (and every time) MoveNext is called on the
result record set.

I've looked into this error and some articles on the web relate it to
exchange, recommending a machine restart. I've done that the problem
persists. There's no errors with this exchange server with Outlook for
example, so I'm hard pressed to think it's not something with my
application.

Any help or guidance would be appreciated, and yes, I've seen the articles
google gives you on "enumerating contacts with c#" (terrible IMO), and have
read the microsoft articles.
Code
string url = urlTextBox.Text;

ADODB.Connection con = null;
ADODB.Recordset rs = null;

try
{
// create the connection
con = new ADODB.Connection();
con.Provider = "exoledb.datasource";
con.Open(url, "", "", 0);

// build SQL query
string SqlQuery = "SELECT * FROM \"" + url + "\"";

// build the record set object
rs = new ADODB.Recordset();
rs.Open(SqlQuery,
con,
ADODB.CursorTypeEnum.adOpenDynamic,
ADODB.LockTypeEnum.adLockOptimistic,
0);

// enumarate through the retrieved record set
for (; !rs.EOF; rs.MoveNext()) // <<<--- "Bookmark is invalid"
exception
{
usernamesTextBox.Text +=
rs.Fields["urn:schemas:contacts:givenName"].Value.ToString() +"\r\n";
}

}
catch (Exception ex)
{
MessageBox.Show("OOPS!\r\n------\r\n\r\n" + ex.ToString());
}
finally
{

if (rs != null && rs.State ==
(int)ADODB.ObjectStateEnum.adStateOpen)
rs.Close();
if (con != null && con.State ==
(int)ADODB.ObjectStateEnum.adStateOpen)
con.Close();
}
Nov 17 '05 #1
2 3482

MDAC 2.6 appears to have this problem, upgrading the server to 2.8 sorted it
out.

"Dan Bass" <Not Listed> wrote in message
news:ez*************@TK2MSFTNGP09.phx.gbl...

Environment
C#, Asp.Net 2.0, Windows 2000 Server
Problem
I'm trying to enumerate all the names in the global contacts on the
exchange server using CDO / ADO / (whatever I can).
In writing an ASP.Net support ticket application, I want to populate the
list of "Who reported this ticket" with names from the global contacts.
An extension of this would then be to allow the user to add a person to
the global contact via the web page, should they not exist in the contacts
list.

To start with, I'm writing a basic windows application with one textbox as
the input providing the URL to get the contacts from, and one text box as
the output to put any contacts names I find into. I compile this
application then try to run it on the exchange server, but get an error
saying the "Bookmark is invalid" the first (and every time) MoveNext is
called on the result record set.

I've looked into this error and some articles on the web relate it to
exchange, recommending a machine restart. I've done that the problem
persists. There's no errors with this exchange server with Outlook for
example, so I'm hard pressed to think it's not something with my
application.

Any help or guidance would be appreciated, and yes, I've seen the articles
google gives you on "enumerating contacts with c#" (terrible IMO), and
have read the microsoft articles.
Code
string url = urlTextBox.Text;

ADODB.Connection con = null;
ADODB.Recordset rs = null;

try
{
// create the connection
con = new ADODB.Connection();
con.Provider = "exoledb.datasource";
con.Open(url, "", "", 0);

// build SQL query
string SqlQuery = "SELECT * FROM \"" + url + "\"";

// build the record set object
rs = new ADODB.Recordset();
rs.Open(SqlQuery,
con,
ADODB.CursorTypeEnum.adOpenDynamic,
ADODB.LockTypeEnum.adLockOptimistic,
0);

// enumarate through the retrieved record set
for (; !rs.EOF; rs.MoveNext()) // <<<--- "Bookmark is invalid"
exception
{
usernamesTextBox.Text +=
rs.Fields["urn:schemas:contacts:givenName"].Value.ToString() +"\r\n";
}

}
catch (Exception ex)
{
MessageBox.Show("OOPS!\r\n------\r\n\r\n" + ex.ToString());
}
finally
{

if (rs != null && rs.State ==
(int)ADODB.ObjectStateEnum.adStateOpen)
rs.Close();
if (con != null && con.State ==
(int)ADODB.ObjectStateEnum.adStateOpen)
con.Close();
}

Nov 17 '05 #2

MDAC 2.6 appears to have this problem, upgrading the server to 2.8 sorted it
out.

"Dan Bass" <Not Listed> wrote in message
news:ez*************@TK2MSFTNGP09.phx.gbl...

Environment
C#, Asp.Net 2.0, Windows 2000 Server
Problem
I'm trying to enumerate all the names in the global contacts on the
exchange server using CDO / ADO / (whatever I can).
In writing an ASP.Net support ticket application, I want to populate the
list of "Who reported this ticket" with names from the global contacts.
An extension of this would then be to allow the user to add a person to
the global contact via the web page, should they not exist in the contacts
list.

To start with, I'm writing a basic windows application with one textbox as
the input providing the URL to get the contacts from, and one text box as
the output to put any contacts names I find into. I compile this
application then try to run it on the exchange server, but get an error
saying the "Bookmark is invalid" the first (and every time) MoveNext is
called on the result record set.

I've looked into this error and some articles on the web relate it to
exchange, recommending a machine restart. I've done that the problem
persists. There's no errors with this exchange server with Outlook for
example, so I'm hard pressed to think it's not something with my
application.

Any help or guidance would be appreciated, and yes, I've seen the articles
google gives you on "enumerating contacts with c#" (terrible IMO), and
have read the microsoft articles.
Code
string url = urlTextBox.Text;

ADODB.Connection con = null;
ADODB.Recordset rs = null;

try
{
// create the connection
con = new ADODB.Connection();
con.Provider = "exoledb.datasource";
con.Open(url, "", "", 0);

// build SQL query
string SqlQuery = "SELECT * FROM \"" + url + "\"";

// build the record set object
rs = new ADODB.Recordset();
rs.Open(SqlQuery,
con,
ADODB.CursorTypeEnum.adOpenDynamic,
ADODB.LockTypeEnum.adLockOptimistic,
0);

// enumarate through the retrieved record set
for (; !rs.EOF; rs.MoveNext()) // <<<--- "Bookmark is invalid"
exception
{
usernamesTextBox.Text +=
rs.Fields["urn:schemas:contacts:givenName"].Value.ToString() +"\r\n";
}

}
catch (Exception ex)
{
MessageBox.Show("OOPS!\r\n------\r\n\r\n" + ex.ToString());
}
finally
{

if (rs != null && rs.State ==
(int)ADODB.ObjectStateEnum.adStateOpen)
rs.Close();
if (con != null && con.State ==
(int)ADODB.ObjectStateEnum.adStateOpen)
con.Close();
}

Nov 17 '05 #3

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

Similar topics

0
by: Dan Bass | last post by:
Environment C#, Asp.Net 2.0, Windows 2000 Server Problem I'm trying to enumerate all the names in the global contacts on the exchange server using CDO / ADO / (whatever I can). In writing an...
0
by: George Durzi | last post by:
Hey all, I finally found the necessary resources in the Exchange 2003 SDK to "pull" Contacts out of Exchange and display them on a WebForm. I have been trying to do this forever, and couldn't...
1
by: SWu | last post by:
Hello everyone, I am working on an Internet website for an Application Service Provider. A user can store employee details on the site. I am now researching the feasibility of accessing the...
11
by: ML | last post by:
What is th best/easiest way to access a public contacts folder on an Exchange server from a winforms vb.net applciation? I would like to be able to provide the user with a list of contacts and...
1
by: tyronne | last post by:
I have created a data base that is linked to contacts in personA's outlook contacts, I need personB and PersonC to be able to also edit the data base which include a dropdown for personA's...
2
by: tthomas | last post by:
Greetings, I am using CDO.Message to send email messages from my application. I now need to send email to existing distribution lists in our Global Address List. However, our exchange server...
0
by: eric.nguyen312 | last post by:
Hi, I want to know if its possible to export my Contacts table to Global Address List on Exchange so I can view all the contacts in Outlook? Thanks, Eric
0
by: BD | last post by:
I am developing a SQL Server application and I would like to populate a list box with the names in our public contacts that are on Exchange Server. How can I accomplish this without a 3rd party...
2
by: =?Utf-8?B?VmlkZHM=?= | last post by:
Hi All, Could anyone please help me regarding this issue.I need to access or Import Outlook Contact Details from my Asp.Net web application my code behind is c#. Thanks in advance. Regards,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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...

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.