|
-
May 13th, 2004, 02:30 AM
#1
Thread Starter
New Member
access microsoft exchange server users inbox data using asp.net
i am software developer my client want to access exchange server users data through web application
I create asp.net application on the same machine where exchange server is install
the follwoi8ng code ,applied in application
================================================
Dim cURL As String
Sub FindMsgsFrom(ByVal sender, ByVal Conn)
Const adErrNoCurrentRecord = 3021
Dim FolderURL As String
FolderURL = "Inbox"
Dim strq As String
Dim rs As ADODB.Recordset
rs = CreateObject("ADODB.Recordset")
'construct the SQL query, note the scope for deep traversal
strq = "SELECT ""urn:httpmail:subject"" "
strq = strq & "FROM scope('shallow traversal of """ & FolderURL & """ ')"
' strq = strq & "WHERE ""urn:schemas:httpmail:sendername"" = '" & sender & "'"
rs.Open(strq, Conn, ADODB.CursorTypeEnum.adOpenKeyset, ADODB.LockTypeEnum.adLockReadOnly, -1)
'If empty recordset, return error
'If successful call DoResults routine passing the recorset
If rs.EOF = True Then
On Error Resume Next
Err.Raise(adErrNoCurrentRecord)
Response.Write("No items found, run another query.")
Else
Response.Write("Success! Found " & rs.RecordCount)
DoResults(rs)
End If
rs.Close()
End Sub
Function DoResults(ByVal Rs As ADODB.Recordset)
'If empty recordset, return error
Dim f As ADODB.Field
If Rs.EOF = True Then
'On Error Resume Next
'Err.Raise(adErrNoCurrentRecord)
Response.Write("<br><FONT FACE=Arial SIZE=2>No items found, run another query.<p>")
Else
Rs.MoveFirst()
Do Until Rs.EOF
'Create a HTML table for each record, make table headings stand out
Response.Write("<FONT FACE=Arial SIZE=2><TABLE BORDER=1 cellpadding=5 cellspacing=5>")
Response.Write("<TR><TH bgcolor=#0000ff><FONT color=#ffffff>Property</TH>")
Response.Write("<TH bgcolor=#0000ff><FONT color=#ffffff>Value</TH></TR>")
For Each f In Rs.Fields
'for every field in the record
Response.Write("<TR><TD><FONT SIZE=1>")
Response.Write(f.Name)
Response.Write("</TD><TD><FONT SIZE=1>")
'accommodate null and multivalued properties
If Not IsDBNull(f.Value) Then
If IsArray(f.Value) Then
'a multivalued property
Dim V
For Each V In f.Value
On Error Resume Next
Response.Write(V & "<br>")
Next
Else
On Error Resume Next
Response.Write(f.Value)
End If
Else
'Field is null
Response.Write("Null")
End If
Response.Write("</TD></TR>")
Next
Response.Write("</TABLE><br><hr><br>")
Rs.MoveNext()
Loop
End If
End Function
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'Finds items from a sender, searching subfolders
'Passes search result recordset to DoResults (see Enumerating Results)
'get computer and domain information
'info = CreateObject("ADSystemInfo")
'infoNT = CreateObject("WinNTSystemInfo")
'cName = infoNT.ComputerName
'dName = info.DomainDNSName
'create connection object
' Try
Dim conn As ADODB.Connection
conn = CreateObject("ADODB.Connection")
conn.Provider = "Exoledb.DataSource"
'URL for connection object
'is at the virtual directory root
cURL = "http://domain/exchange/shanawazpatel/"
conn.Open(cURL, "", "", -1)
'relative URL is the folder to search
'relURL = "Reports"
sender = "Jane Clayton"
FindMsgsFrom(sender, conn)
' Catch ex As Exception
' Response.Write(ex.Message)
' End Try
End Sub
=================================================
i am getting error
the error will display as below
Server Error in '/MailApplication' Application.
--------------------------------------------------------------------------------
Permission denied.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Runtime.InteropServices.COMException: Permission denied.
Source Error:
Line 256: ' strq = strq & "WHERE ""urn:schemas:httpmail:sendername"" = '" & sender & "'"
Line 257:
Line 258: rs.Open(strq, Conn, ADODB.CursorTypeEnum.adOpenKeyset, ADODB.LockTypeEnum.adLockReadOnly, -1)
Line 259:
Line 260: 'If empty recordset, return error
Source File: \\domain\wwwroot\MailApplication\ExchangeUsingADO.aspx.vb Line: 258
Stack Trace:
[COMException (0x80040e09): Permission denied.]
ADODB.RecordsetClass.Open(Object Source, Object ActiveConnection, CursorTypeEnum CursorType, LockTypeEnum LockType, Int32 Options) +0
MailApplication.ExchangeUsingADO.FindMsgsFrom(Object sender, Object Conn) in \\domain\wwwroot\MailApplication\ExchangeUsingADO.aspx.vb:258
MailApplication.ExchangeUsingADO.Button1_Click(Object sender, EventArgs e) in \\domain\wwwroot\MailApplication\ExchangeUsingADO.aspx.vb:350
System.Web.UI.WebControls.Button.OnClick(EventArgs e)
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
System.Web.UI.Page.ProcessRequestMain()
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.1.4322.573; ASP.NET Version:1.1.4322.573
=============================================================
can any body give me solution
can any setting need for iis or exchange server
or any other solution
please help me out
-
Sep 19th, 2009, 04:00 PM
#2
New Member
Re: access microsoft exchange server users inbox data using asp.net
Hi,
Aspose provides .NET component for accessing emails from Exchange Server mailbox. Please visit http://www.aspose.com/documentation/...ge-server.html for details. You can use Aspose.Network in any .NET project type e.g. ASP.NET, Windows Forms, Console, Web Service etc
-
Sep 20th, 2009, 02:58 AM
#3
Re: access microsoft exchange server users inbox data using asp.net
There are 21 different ways to talk to Exchange.
I think you're looking for ADSI/Directory Services, if you want to access sender information.
-
Sep 20th, 2009, 12:35 PM
#4
Re: access microsoft exchange server users inbox data using asp.net
Hello shanawazpatel,
When you are posting code into the forum, can you make sure you wrap it in CODE tags, it makes it a lot easier to read, and people will be more likely to look at the code if they can see it clearly.
Does the identity that is running the Application Pool of your ASP application have access to the Exchange Server?
Gary
-
Oct 15th, 2009, 12:41 PM
#5
New Member
Re: access microsoft exchange server users inbox data using asp.net
Can you use WebDAV to access MS Exchange Delegate information from a .Net application? Also, updating MS Exchange Delegate information through the .Net app? The Exchange Server is 2003. I need to write a web application that can view and modify delegate information. Is this possible? Can I use MAPI, CDOEXM, or WebDAV to do this?
Any information is very much appreciated.
Thanks
-
Oct 15th, 2009, 12:42 PM
#6
Re: access microsoft exchange server users inbox data using asp.net
Hey,
Have you read the link that Mendhak posted?
It pretty much sums up all your options.
Gary
-
Oct 15th, 2009, 12:50 PM
#7
New Member
Re: access microsoft exchange server users inbox data using asp.net
Thanks for the fast reply. The link lists over 20 ways to do it. Wondering if anyone knows how I can do it without researching the 20 different ways? Again, I need to view and edit Exchange/AD Delegate settings through a .net web application. The web application will be running on a different server. It is Exchange 2003. Any quick thoughts or recommendations would be appreciated. If someone can guide me down the right path I can look down that path in detail.
Thanks again,
-
Oct 15th, 2009, 12:52 PM
#8
Re: access microsoft exchange server users inbox data using asp.net
Hey,
I personally couldn't say, as I haven't played with all of them.
I guess you would at least have to do some investigation on all of them in order to understand how they are different, so then you can make in informed decision.
Gary
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|