Accessing data in Exchange database using ADO.NET
Exchange Server Forum Index Exchange Server
Discussion forums for Microsoft Exchange Server users.
Microsoft Outlook
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Google
 
Web ExchangeServerHelp.com
Accessing data in Exchange database using ADO.NET

 
Post new topic   Reply to topic    Exchange Server Forum Index -> Development
Author Message
wolfgang wedenig
Guest





Posted: Tue Sep 27, 2005 8:58 am    Post subject: Accessing data in Exchange database using ADO.NET Reply with quote

Hello all,

I'm new at programming application that should access the Microsoft Exchange
database and therefore I need some help.

For my customer application I have to access data that is stored in
Microsoft SQL Server and Microsoft Exchange Server and I have to link those
data. I was already able to do this in previous solutions. I found a sample
(pseudo) code in Microsofts knowledge base.

Public Function GetStorageName() As String
On Error Resume Next

Dim SysInfo As New ActiveDs.ADSystemInfo
Dim sName As String = SysInfo.DomainDNSName

If sName.Length <> 0 Then
sName = "file://./backofficestorage/" & sName & "/Public
Folders/"
Else
Err.Raise(Err.Number, Err.Source, "Unable to retrieve domain
name.")
End If

Return sName
End Function

Public Function Search(param As String) As String
Try
Dim cnn As ADODB.Connection
Dim rst As ADODB.Recordset
Dim fd As ADODB.Field
Dim urlQueryFld As String = GetStorageName()
Dim sExFldr As String =
System.Configuration.ConfigurationSettings.AppSettings.GetValues("ExFldr")(0)

cnn = New ADODB.Connection
cnn.Provider = "exoledb.datasource"
cnn.Open(urlQueryFld & sExFldr & "/")

'....
End Function

Everything works fine. As far as I found out the method GetStorageName works
fine and returns something like
file://./backofficestorage/CUSTOMERNAME.local/Public Folders/. sExFldr is
used to store the name of a public folder which is configured in my
configuration file (eg. "Contacts"). But when I want to open my connection
to this public folder I got the following error message:

System.Exception: System.Exception: System.Exception:
System.Runtime.InteropServices.COMException (0x80150804): Exception in
HRESULT: 0x80150804. at ADODB.ConnectionClass.Open(String ConnectionString,
String UserID, String Password, Int32 Options)...

I tried it out on multiple test machines without any troubles. On my test
server I have installed Microsoft Small Business Server 2003 (with Exchange
2003 and Microsoft SQL Server 2000 with Service Pack 3a) and on the
production server we have Microsoft Small Business Server Service Pack 1
(with Exchange 2003 and Microsoft SQL Server 2000 with Service Pack 4).
Furthermore I installed Pervasive SQL 2000 (Service Pack 3) on the
production server. Could this configuration cause any troubles?

On both machines I used the default setup. Are there any known issues that
are coming with Service Pack 1?

Any suggestions are welcome.

Best regards from Austria,
Wolfgang

Back to top
Brett
Guest





Posted: Tue Sep 27, 2005 4:58 pm    Post subject: Re: Accessing data in Exchange database using ADO.NET Reply with quote

I don't know... but it looks like standard ADO to me; not ADO.net. But
then again, I'm pretty new at this.
I don't even think you can access the store at this point through
ado.net, can you?
Back to top
Glen Scales [MVP]
Guest





Posted: Wed Sep 28, 2005 12:58 am    Post subject: Re: Accessing data in Exchange database using ADO.NET Reply with quote

I would be careful to check that your using the right file URI. The file URI
domain name comes from the default recipient policy which may or may not be
the same as your Active Directory domain name see
http://blogs.technet.com/exchange/archive/2004/04/02/106778.aspx . Eg if
your using SBS and you've using something like mydomain.local for Active
Directory and your default SMTP domain is mydomain.com then your
GetStorageName() function will return the wrong domain name.

Cheers
Glen



"wolfgang wedenig" <we@happynet.at> wrote in message
news:uz77NKzwFHA.2516@TK2MSFTNGP12.phx.gbl...
Quote:
Hello all,

I'm new at programming application that should access the Microsoft
Exchange database and therefore I need some help.

For my customer application I have to access data that is stored in
Microsoft SQL Server and Microsoft Exchange Server and I have to link
those data. I was already able to do this in previous solutions. I found a
sample (pseudo) code in Microsofts knowledge base.

Public Function GetStorageName() As String
On Error Resume Next

Dim SysInfo As New ActiveDs.ADSystemInfo
Dim sName As String = SysInfo.DomainDNSName

If sName.Length <> 0 Then
sName = "file://./backofficestorage/" & sName & "/Public
Folders/"
Else
Err.Raise(Err.Number, Err.Source, "Unable to retrieve domain
name.")
End If

Return sName
End Function

Public Function Search(param As String) As String
Try
Dim cnn As ADODB.Connection
Dim rst As ADODB.Recordset
Dim fd As ADODB.Field
Dim urlQueryFld As String = GetStorageName()
Dim sExFldr As String =
System.Configuration.ConfigurationSettings.AppSettings.GetValues("ExFldr")(0)

cnn = New ADODB.Connection
cnn.Provider = "exoledb.datasource"
cnn.Open(urlQueryFld & sExFldr & "/")

'....
End Function

Everything works fine. As far as I found out the method GetStorageName
works fine and returns something like
file://./backofficestorage/CUSTOMERNAME.local/Public Folders/. sExFldr is
used to store the name of a public folder which is configured in my
configuration file (eg. "Contacts"). But when I want to open my connection
to this public folder I got the following error message:

System.Exception: System.Exception: System.Exception:
System.Runtime.InteropServices.COMException (0x80150804): Exception in
HRESULT: 0x80150804. at ADODB.ConnectionClass.Open(String
ConnectionString, String UserID, String Password, Int32 Options)...

I tried it out on multiple test machines without any troubles. On my test
server I have installed Microsoft Small Business Server 2003 (with
Exchange 2003 and Microsoft SQL Server 2000 with Service Pack 3a) and on
the production server we have Microsoft Small Business Server Service Pack
1 (with Exchange 2003 and Microsoft SQL Server 2000 with Service Pack 4).
Furthermore I installed Pervasive SQL 2000 (Service Pack 3) on the
production server. Could this configuration cause any troubles?

On both machines I used the default setup. Are there any known issues that
are coming with Service Pack 1?

Any suggestions are welcome.

Best regards from Austria,
Wolfgang


Back to top
 
Post new topic   Reply to topic    Exchange Server Forum Index -> Development All times are GMT
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




Windows Server Dedicated Servers
Contact Us
New Topics Powered by phpBB