Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 631127
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T19:55:51+00:00 2026-05-13T19:55:51+00:00

ThisAddIn class created with new Outlook VSTO C# project has a Application property that

  • 0

ThisAddIn class created with new Outlook VSTO C# project has a Application property that you can use to among other things get access to Outlook folders and items. The problem is that you can easily use it when you’re inside of ThisAddIn class but there’s no easy access to it from other classes in the project. This is because it’s an instance property.

I want to find the best way of having access to the same functionality this property provides in my other classes so I come up with two possible solutions but I don’t know which one (if any) of them is good.

Lets assume I want to get default inbox folder. Inside ThisAddIn class I would simply do something like this:

this.Application.Session.GetDefaultFolder(Outlook.olFolderInbox);

Now how to do the same outside this class?

1. Static property

First, I could add a static property to ThisAddIn class and set it to the value I want to expose in other classes.

public partial class ThisAddIn
{
    public Outlook.Application OutlookApp;

    void ThisAddIn_Startup(object sender, EventArgs e)
    {
        // init static variable value here
        OutlookApp = this.Application

        // initialize the rest of addin here
    }

    void InternalStartup()
    {
        this.Startup += this.ThisAddIn_Startup;
    }
}

This way in any of my other classes I could do something like this:

ThisAddIn.OutlookApp.Session.GetDefaultFolder(Outlook.olFolderInbox);

2. Create new Application object

Second thing that I could do is to init Application object in my other class before I use it. But I’m not sure if creating new object of that type doesn’t create a new instance of Outlook.

class MyOtherClass
{
    public void MyMethod()
    {
        var app = new Outlook.Application();
        var folder = app.Session.GetDefaultFolder(Outlook.olFolderInbox);
    }
}

Does anyone have any suggestions which approach is better, of if you have different solutions for this problem I’d apprieciate that as well.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T19:55:52+00:00Added an answer on May 13, 2026 at 7:55 pm

    Since you can have single Instance of ThisAddIn you can have a static variable to access Application form outside… FYI when you add Outlook-AddIn VSTO project,instance of ThisAddIn will be available as static member in static class Globals

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to use C# class methods in Excel. Can anybody guid me how
I'm developing an outlook addin that has a button in a custom task pane
I've written this little MS Outlook 2003 VSTO Add-In using C# and Visual Studio
I was looking at one of the webcasts and found that class name had
My VSTO Outlook Add-in suddenly stopped working on one customer machine (it does not
I created the following automation addin: namespace AutomationAddin { [Guid(6652EC43-B48C-428a-A32A-5F2E89B9F305)] [ClassInterface(ClassInterfaceType.AutoDual)] [ComVisible(true)] public class
i am developing a outlook addin in c#, heres my startup: private void ThisAddIn_Startup(object
I am developing an addin to Microsoft Outlook. The following code works fine if
I have created an assembly and later renamed it. Then I started getting runtime
It took some time to solve this and the conclusions are interesting. Our Office

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.