Blue Theme Orange Theme Green Theme Red Theme
 
Discover the top 5 tips for understanding .NET Interop
Home | Forums | Videos | Advertise | Certifications | Downloads | Blogs | Interviews | Jobs | Beginners | Training
 | Consulting  
Submit an Article Submit a Blog 
 Jump to
Skip Navigation Links
TechnologyExpand Technology
WebsiteExpand Website
6 Months Free & No Setup Fees ASP.NET Hosting!
Search :       Advanced Search »
Home » .NET Remoting » Office automation with VS 2008

Office automation with VS 2008

Outlook automation has become integral part of any LOB application. MS Excel, work, outlook are getting used by most of the enterprise applications today. This article provides quick view on how to integrate outlook with .net application

Page Views : 7408
Downloads : 211
Rating :
 Rate it
Level : Beginner
   Print Read/Post comments Post a comment  Similar Articles  
   Email to a friend  Bookmark  Author's other articles  
Download Files:
OutlookAddIn.zip
 
 
6 Months Free & No Setup Fees ASP.NET Hosting!
Become a Sponsor
 Tag Cloud
 Latest Jobs
More ... 
 Latest Interview Questions
More ... 


Introduction

Outlook automation has become integral part of any LOB application. MS Excel, work, outlook are getting used by most of the enterprise applications today. This article provides quick view on how to integrate outlook with .net application.

In this example we will create a button in outlook on click of that button it will execute a method in an application.
Steps to create outlook project:

  1. Click on new project.
  2. Select "Office" as project type
  3. Select "Office 2007 Add in" template from right side pane.
  4. Enter name of the addin and path for the project; click on Ok
  5. Visual Studio will create "ThisAddIn.cs" file for you.
  6. Write below code snippet in the ThisAddIn_Startup.

    a. Generate command bar.



    b. Generate command button.

Steps to create .net Application

  1. Open Visual Studio. Click on File->New->Project
  2. Select Windows from left pane.
  3. Select Windows Forms application from right pane.
  4. Enter name and location of project
  5. Click on Ok.
  6. Below code snippet shows how to create remotable object.

    a. Code snippet for IRemoteObject



    b. Code snippet for RemoteObject


     
  7. Below code snippet show how to create remote server to listen request from outlook


     
  8. Add a new window form with a button in the same project. Set caption of the form as Server and button caption as "Start Server".
     
  9. In the button click write below code.

Steps to integrate with .net application

  1. In ThisAddin.cs file we created defination for _myButton _Click. Write below lines of code in the defination.

Steps to install Outlook application

  1. In the same instance of Visual Studio of outlook project. Click on File->New->Project
  2. Select "Setup and Deployment" under "Other Project Type" from left pane.
  3. Select "Setup Project" from right pane.
  4. In "File System Editor" select "Application folder" from left pane.
  5. Right click on "Application folder" and select Add->Project Output.
  6. In the "Add Project Output group" window select Outlook project.
  7. Select "Primary Output" from below list box.
  8. Click on Ok
  9. Outlook project output and related dependent files will get added in the Application folder.
  10. Build the setup project.
  11. Navigate to the output folder of the setup project and run setup.exe
  12. After the completion of setup start MS Outlook
  13. You must see button gets added in the tool bar.

Now run your windows form application and start server by clicking on the "Start Server" button.

Click "Click Me" button on MS Outlook , you must get message "Call from outlook".

Comment Request!
Thank you for reading this post. Please post your feedback, question, or comments about this post Here.
Login to add your contents and source code to this article
 [Top] Rate this article
 
 About the author
 
kohad
Looking for C# Consulting?
C# Consulting is founded in 2002 by the founders of C# Corner. Unlike a traditional consulting company, our consultants are well-known experts in .NET and many of them are MVPs, authors, and trainers. We specialize in Microsoft .NET development and utilize Agile Development and Extreme Programming practices to provide fast pace quick turnaround results. Our software development model is a mix of Agile Development, traditional SDLC, and Waterfall models.
Click here to learn more about C# Consulting.
 
Introducing MaxV - one click. infinite control. Hyper-V Hosting from MaximumASP.
Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon. Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees. As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
Dynamic PDF
ceTE software specializes in components for dynamic PDF generation and manipulation. The DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and new content to existing PDF documents from within your applications.
Discover the Top 5 .NET Memory Management Fundamentals
To write the best .NET code, you need to know exactly how the .NET framework really manages memory. Ricky Leeks presents the Top 5 fundamental facts of .NET memory management. Learn more.
Nevron Chart for .NET 2010.1 Now Available
The leading .NET charting control now features PDF, Flash and Silverlight export, visualization of large datasets and more. Deliver true charting functionality to your BI, Scorecard, Presentation or Scientific apps. Download evaluation now.
ASP.NET 4 Hosting
Get 2 Months Free of ASP.NET Hosting for Only $4.95/month! Receive FREE MS SQL and MySQL Databases Including ASP.NET 4/3.5, MVC 3.0, Silverlight 4, Windows 2008/IIS 7.0 Plus FREE IIS 7 Modules. Host UNLIMITED ASP.NET Web Sites – Click Here!
 
 Post a Feedback, Comment, or Question about this article
Subject:
Comment:
Discover the top 5 tips for understanding .NET Interop
Become a Sponsor
 Comments
Errors by ASPbee On May 12, 2011
Hi - I am not sure if anyone got chance to work on this article but when i am trying to work by creating a new project "SampleOutlookAddIn" i am not able to build the project. The errors are as below. a.)Type or Namespace of TCP not found - RemoteServer.cs b.)Cannot find WindowsApplication.exe file and - SampleOutlookAddInSetup c.)Cannot find OutlookAddIn.dll - SampleOutlookAddInSetup thanks Can someone help with the errors above
Reply | Email | Modify 
DevExpress Free UI Controls
 © 2012  contents copyright of their authors. Rest everything copyright Mindcracker. All rights reserved.