Hi, I am trying access my exchange server thru asp.net. i am using following code. its throwing following error. -------------------------------------------------------------------------------------------- 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.Exception: Cannot create ActiveX component. Source Error: Line 22: ' Create the CDO
session object Line 23: objSession = CreateObject("MAPI.Session") Line 24: bstrProfileInfo = bstrServer + vbLf + strAlias Line 25: 'Logon Source File: c:\inetpub\wwwroot\test\exch.aspx Line: 23 --------------------------------------------------------------------------------------------
what should i do to create it ???? iam totally new to this...please advice me.... Thanks, Susan Below is the code iam using ..... -------------------------------------------------------------------------------------------- <script runat="server"> Sub Button_Click(sender
As Object, e As EventArgs) 'Put user code to initialize the page here Dim bstrServer As String Dim strAlias As String Dim objSession As Object Dim bstrProfileInfo As String Dim objInfoStore As Object Dim RtFolder As Object Dim objFolders As Object Dim ObjFolder
As Object Dim subfolders As Object Dim Nameval As String Dim SubFolder As Object bstrServer = "exchangename" 'the name of the Exchange 5.5 server. strAlias = "susan voyce" ' Create the CDO session object objSession = CreateObject("MAPI.Session") bstrProfileInfo
= bstrServer + vbLf + strAlias 'Logon objSession.Logon(, , , True, , True, bstrProfileInfo) ' Get your default information store objInfoStore = objSession.GetInfoStore("") ' Get to the root folder RtFolder = objInfoStore.RootFolder ' Loop through all the folders.
objFolders = RtFolder.Folders ObjFolder = objFolders.GetFirst() For Each ObjFolder In objFolders Nameval = ObjFolder.Name subfolders = ObjFolder.Folders If subfolders.Count > 0 Then SubFolder = subfolders.GetFirst() For Each SubFolder In subfolders Nameval
= SubFolder.Name Response.Write("Folder: " & Nameval & "
") Next End If Next 'Logoff and release all the objects objSession.Logoff() objSession = Nothing end sub </script>
you cant do it that way in asp.net (that asp only). you need to import the namespace of the object and in most cases create an instance of it. i think that is what you are trying to do.
Hi, CGGamer how to create an instance of it ...and how to import the namespace. please advice me.... netprofit i want to access the public folder of my outlook thru asp.net... thanks, susan
the .net framework is made up of classes and namespaces: http://samples.gotdotnet.com/quickstart/aspplus/samples/classbrowser/vb/classbrowser.aspx you can import a namespace such as: and create an instance of an object from that namespace like: dim objDR as
new DataRow what you are looking for is the System.IO Namespace. it allows you search through files on your computer and other things too. take a look at it in the link above.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemIOPathClassTopic.asp i will try to find examples and post there links.
http://dotnetjunkies.com/tutorials.aspx?tutorialid=392 http://www.aspfree.com/aspnet/filedirhandling.aspx http://www.vbwm.com/articles/builder/viewer.asp?ArticleID=15 hope these help
i know createobject creates an instance . but the line which tries create an instance is throwing error . "CANNOT CREATE ACTIVEX COMPONENT". any idea ...???? Thanks !
susan voyce
Member
35 Points
7 Posts
Please help mee...
Nov 18, 2002 04:34 PM|LINK
") Next End If Next 'Logoff and release all the objects objSession.Logoff() objSession = Nothing end sub </script>
NetProfit
Contributor
6278 Points
1252 Posts
Re: Please help mee...
Nov 18, 2002 04:55 PM|LINK
Dim myMessage As New Mail.MailMessage() myMessage.To = myRecip myMessage.From = myEmailAccount myMessage.Body = myMessageText myMessage.BodyFormat = Mail.MailFormat.Text myMessage.Subject = "Check This Out!" Mail.SmtpMail.Send(myMessage)Will this work in your situation?CGGamer
Member
515 Points
103 Posts
Re: Please help mee...
Nov 18, 2002 05:34 PM|LINK
NetProfit
Contributor
6278 Points
1252 Posts
Re: Please help mee...
Nov 18, 2002 05:52 PM|LINK
susan voyce
Member
35 Points
7 Posts
Re: Please help mee...
Nov 18, 2002 06:45 PM|LINK
CGGamer
Member
515 Points
103 Posts
Re: Please help mee...
Nov 18, 2002 08:04 PM|LINK
CGGamer
Member
515 Points
103 Posts
Re: Please help mee...
Nov 18, 2002 08:07 PM|LINK
CGGamer
Member
515 Points
103 Posts
Re: Please help mee...
Nov 18, 2002 08:14 PM|LINK
susan voyce
Member
35 Points
7 Posts
Re: Please help mee...
Nov 19, 2002 12:48 AM|LINK
NetProfit
Contributor
6278 Points
1252 Posts
Re: Please help mee...
Nov 19, 2002 10:31 AM|LINK