473,785 Members | 2,768 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 "enumeratin g contacts with c#" (terrible IMO), and have
read the microsoft articles.
Code
string url = urlTextBox.Text ;

ADODB.Connectio n con = null;
ADODB.Recordset rs = null;

try
{
// create the connection
con = new ADODB.Connectio n();
con.Provider = "exoledb.dataso urce";
con.Open(url, "", "", 0);

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

// build the record set object
rs = new ADODB.Recordset ();
rs.Open(SqlQuer y,
con,
ADODB.CursorTyp eEnum.adOpenDyn amic,
ADODB.LockTypeE num.adLockOptim istic,
0);

// enumarate through the retrieved record set
for (; !rs.EOF; rs.MoveNext()) // <<<--- "Bookmark is invalid"
exception
{
usernamesTextBo x.Text +=
rs.Fields["urn:schemas:co ntacts:givenNam e"].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.Obje ctStateEnum.adS tateOpen)
rs.Close();
if (con != null && con.State ==
(int)ADODB.Obje ctStateEnum.adS tateOpen)
con.Close();
}
Nov 17 '05 #1
2 3519

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******** *****@TK2MSFTNG P09.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 "enumeratin g contacts with c#" (terrible IMO), and
have read the microsoft articles.
Code
string url = urlTextBox.Text ;

ADODB.Connectio n con = null;
ADODB.Recordset rs = null;

try
{
// create the connection
con = new ADODB.Connectio n();
con.Provider = "exoledb.dataso urce";
con.Open(url, "", "", 0);

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

// build the record set object
rs = new ADODB.Recordset ();
rs.Open(SqlQuer y,
con,
ADODB.CursorTyp eEnum.adOpenDyn amic,
ADODB.LockTypeE num.adLockOptim istic,
0);

// enumarate through the retrieved record set
for (; !rs.EOF; rs.MoveNext()) // <<<--- "Bookmark is invalid"
exception
{
usernamesTextBo x.Text +=
rs.Fields["urn:schemas:co ntacts:givenNam e"].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.Obje ctStateEnum.adS tateOpen)
rs.Close();
if (con != null && con.State ==
(int)ADODB.Obje ctStateEnum.adS tateOpen)
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******** *****@TK2MSFTNG P09.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 "enumeratin g contacts with c#" (terrible IMO), and
have read the microsoft articles.
Code
string url = urlTextBox.Text ;

ADODB.Connectio n con = null;
ADODB.Recordset rs = null;

try
{
// create the connection
con = new ADODB.Connectio n();
con.Provider = "exoledb.dataso urce";
con.Open(url, "", "", 0);

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

// build the record set object
rs = new ADODB.Recordset ();
rs.Open(SqlQuer y,
con,
ADODB.CursorTyp eEnum.adOpenDyn amic,
ADODB.LockTypeE num.adLockOptim istic,
0);

// enumarate through the retrieved record set
for (; !rs.EOF; rs.MoveNext()) // <<<--- "Bookmark is invalid"
exception
{
usernamesTextBo x.Text +=
rs.Fields["urn:schemas:co ntacts:givenNam e"].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.Obje ctStateEnum.adS tateOpen)
rs.Close();
if (con != null && con.State ==
(int)ADODB.Obje ctStateEnum.adS tateOpen)
con.Close();
}

Nov 17 '05 #3

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

Similar topics

0
319
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 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
0
2025
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 until the Exchange 2003 SDK came out. Here's the code. Hopefully someone else can find this useful. #region DisplayExchangeContacts private void DisplayExchangeContacts() {
1
2537
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 contacts stored in the user's local Outlook. In other words, the client browser has to be able to access the user's Outlook contacts. Obviously, the user has to permit the browser to access the contacts. I say "client browser" because the...
11
2843
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 their associated details from what is stored in Exchnage on a custom form inside a winforms application.
1
1804
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 contacts, but when PersonB & C go into the database with there login(i.e from there pc, the database shows up but the drodown data for Person'As contacts is not available In short how can other users have access to this data base
2
12344
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 blocks sending to distribution list (i.e. distribution list is named MyDistList and its email address is MyDistList@mycompany.com) from SMTP email. I have searched in vain for an example of VBA that will extract the email addresses of members of...
0
1583
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
1112
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 tool? Thanks
2
3458
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, Vidds
0
9480
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
10325
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10148
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
10091
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
6740
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
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4053
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
2
3646
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2879
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.