Massoud Mazar's Blog

Sharing The Knowledge

About the author

Massoud Mazar has been doing .net development since 2002. He is founder and president of Evolynx, Inc.
E-mail me Send mail

Recent comments

Don't show

Authors

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2008

Preconfigured slim PC With Subversion as an Appliance

I've been using Subversion at work for some time and found it an awesome version control tool, so I decided to use it at home for my personal projects. Being a Microsoft oriented developer, I did not want to install Linux on my home PC. I tested some different hardware and software configurations to build a Linux based Subversion machine. I ended up with a small form factor (Mini-ITX) machine which only consumes 24 watts of power when turned on but is pretty powerful. Here is the configuration:

CPU: Intel Atom 1.6 GHz (Hyper-threaded)

RAM: 512 MB DDR2-667 MHz

Disk: 160 GB 2.5 inch SATA Hard Drive

CD Drive: Teac slim 24X CD-ROM drive

OS: Ubuntu Server 8.04

This has worked out really well for me and I'm willing to build similar boxes for anyone else who is interested.

 

 

 

 

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Categories: Subversion
Posted by Mazar on Sunday, June 22, 2008 3:05 PM
Permalink | Comments (0) | Post RSSRSS comment feed

Outlook add-in to select "From Account"

If you have setup more than one email account in your Outlook (Work and Home) you may have realized a need for some type of pop-up dialog which will ask you which account you want to use when creating a new email. Outlook lets you define a default account, but obviously that's not good enough. I decided to write a small and simple add-in which will ask me to select the sending account every time I compose a new email. (Even if Outlook already has such a tool, I couldn't find it! and I wanted to gain some Office programming knowledge anyways.)

I used Visual Studio 2008 and created a new Office project of type Outlook Add-in. This will give you the basics you need. Just fill the methods with your code and you are done.

    public partial class ThisAddIn
    {
        private Outlook.Inspectors Inspectors;

        private void ThisAddIn_Startup(object sender, System.EventArgs e)
        {
            Inspectors = this.Application.Inspectors;
            Inspectors.NewInspector += new Microsoft.Office.Interop.Outlook.InspectorsEvents_NewInspectorEventHandler(Inspectors_NewInspector);

            foreach (Outlook.Inspector inspector in Inspectors)
            {
                Inspectors_NewInspector(inspector);
            }
        }

        void Inspectors_NewInspector(Microsoft.Office.Interop.Outlook.Inspector Inspector)
        {
            if (Inspector.CurrentItem is Outlook.MailItem)
            {
                Outlook.MailItem item = (Outlook.MailItem)Inspector.CurrentItem;
                if (string.IsNullOrEmpty(item.Body) && string.IsNullOrEmpty(item.Subject) && string.IsNullOrEmpty(item.To))
                {
                    Outlook.MailItem ThisItem = (Outlook.MailItem)Inspector.CurrentItem;
                    Accounts accForm = new Accounts();
                    System.Windows.Forms.ComboBox cboAccounts = (System.Windows.Forms.ComboBox)accForm.Controls["cboAccounts"];
                    foreach (Outlook.Account account in this.Application.Session.Accounts)
                    {
                        cboAccounts.Items.Add(account.DisplayName);
                    }
                    cboAccounts.SelectedIndex = 0;
                    accForm.ShowDialog();
                    ThisItem.SendUsingAccount = this.Application.Session.Accounts[cboAccounts.SelectedIndex + 1];
                }
            }
        }

        private void ThisAddIn_Shutdown(object sender, System.EventArgs e)
        {
            Inspectors.NewInspector -= new Outlook.InspectorsEvents_NewInspectorEventHandler(Inspectors_NewInspector);
            Inspectors = null;
        }

        #region VSTO generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InternalStartup()
        {
            this.Startup += new System.EventHandler(ThisAddIn_Startup);
            this.Shutdown += new System.EventHandler(ThisAddIn_Shutdown);
        }
       
        #endregion
    }

 

Accounts() is a Windows Form which only contains a dropdown and a button:

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Categories: Outlook add-in
Posted by Mazar on Monday, June 16, 2008 8:56 AM
Permalink | Comments (0) | Post RSSRSS comment feed