Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Interop / September 2004

Tip: Looking for answers? Try searching our database.

Asp.net and outlook

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jon Dixon - 03 Sep 2004 09:39 GMT
Hi, i am having problems accessing outlook from asp.net.

I create a C# console application which connect to outlook fine however when changing it to work with asp.net it just hangs can someone tell me what it wrong with it.

Thanks

Code

try
            {
               
                Outlook.Application oApp = new Outlook.Application();

                Outlook.NameSpace oNS = oApp.GetNamespace("mapi");

               
                oNS.Logon(Missing.Value,Missing.Value,false,true);

               
                Outlook.MAPIFolder oInbox = oNS.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox);

               
                Outlook.Items oItems = oInbox.Items;

               
                Outlook.MailItem oMsg = (Outlook.MailItem)oItems.GetFirst();

               
                Console.WriteLine(oMsg.Subject);
                Console.WriteLine(oMsg.SenderName);
                Console.WriteLine(oMsg.ReceivedTime);
                Console.WriteLine(oMsg.Body);

               
                int AttachCnt = oMsg.Attachments.Count;
                Console.WriteLine("Attachments: " + AttachCnt.ToString());
               
                                oNS.Logoff();

               
                oMsg = null;
                oItems = null;
                oInbox = null;
                oNS = null;
                oApp = null;
            }

               
            catch (Exception e)
            {
                Console.WriteLine("{0} Exception caught: ", e);
            }
Arve Paalsrud - 05 Sep 2004 02:54 GMT
Hi Jon,

Please read this article from Microsoft:
http://support.microsoft.com/default.aspx?scid=http://support.microsoft.com:80/s
upport/kb/articles/q237/9/13.asp&NoWebContent=1


- A

> Hi, i am having problems accessing outlook from asp.net.
>
> I create a C# console application which connect to outlook fine however when changing it to work with asp.net it just hangs can someone tell me what
it wrong with it.

> Thanks
>
[quoted text clipped - 43 lines]
>
> <Id>Yu0PvrCZCkuli3Wkn+rdcg==</Id
Tom Rizzo [MSFT] - 13 Sep 2004 22:00 GMT
If you're using Exchange Server, you should use CDO for Exchange or WebDAV
with ASP .NET.  The Outlook object model is not safe for server-side apps.

Tom

Signature

Looking for a good book on programming Exchange, Outlook, ADSI and
SharePoint?  Check out http://www.microsoft.com/MSPress/books/5517.asp

This posting is provided "AS IS" with no warranties, and confers no rights.

> Hi Jon,
>
[quoted text clipped - 58 lines]
>>
>> <Id>Yu0PvrCZCkuli3Wkn+rdcg==</Id

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.