Monday 8 August 2011

How to add a custom icon in the Ribbon for outlook custom form region

Icon for custom form region in the Outlook ribbon can be set programmatically as follows:
  1. Firstly in Solution Explorer, double click on the .resx file of the form region.
  2. Click on Add Resource->Add Existing File option and select the desired icon file through the Browse window. This will add the image file in a separate Resources folder.
  1. Navigate to the InitializeManifest() function in the code window of form region file and add the following line:

In the above code, “PageIcon” is the name given to the image while adding it to the .resx file.


Friday 5 August 2011

Deployment of Outlook AddIn containing Custom Form Region

Steps to create Installer for Outlook Add In:
Setup Project Settings
1)      Add a Setup Project in the solution.
2)      Right click on setup project. Select View->File System. In File System tab right click on “Application Folder” and select Add-> Project Output. In “Add Project Output Group” select Primary Output.  Selecting primary output will add the required dlls in “Detected Dependencies” folder.
3)      Right-click the Application folder and select Add-> File. Browse to your application folder, and then bin\Release. Select the .dll.manifest, and .vsto files that reside there.
4)      Right click the Application Folder and select Properties Window option. In the Properties window, under DefaultLocation, change ProgramFilesFolder][Manufacturer]\[ProductName] to [AppDataFolder][Manufacturer]\[ProductName].

We’ve now effectively told the setup project to install all our application goodness to the user’s AppData folder (Normally C:\Users\[username]\AppData in Windows 7, for example). We are doing this as this is a safe, sandboxed location that requires a minimum of privileges to install to.
5)      Optionally in the Properties window for the Setup project change values for Manufacturer, Product Name and Version.  Values specified here will be replaced by the corresponding keys in step 4.

Registry Key Settings
To get the add-in working, we will need to add registry keys. When you are developing the solution in Visual Studio, this happens automatically in the background, so it can be a surprise that you will need to do it explicitly! The keys we are creating will be saved to: HKCU\Software\Microsoft\Office\Outlook\Addins.
Open the Registry Panel in the Setup Project and create keys as follows:
1)      Expand the HKEY_CURRENT_USER key, then Software, and rename [Manufacturer] to Microsoft (because we are adding this key to the Microsoft Office section of the Registry).
2)      Create a tree of key values underneath Microsoft: Office\Outlook\Addins
3)      Finally, create a key for your add-in. Give it a unique name, such that it is different from the add-in project name (so you can identify keys created by the installer, and keys created by Visual Studio).
4)      In that key, set the following values:
§  String – “Description”
§  String – “FriendlyName”
§  String – “Manifest” – set this to “[TARGETDIR]MyOutlookAddin.vsto|vstolocal”
[TARGETDIR] is a macro  and specifies the root destination directory for the installation.
§  DWORD – “LoadBehavior” – set this to “3”
(LoadBehavior and not LoadBehaviour!)
      
  1. Select the new key (the one you just set values for) and in the Properties window, set DeleteAtUninstall to be true (important: do not set it for any keys higher up in the tree!)  
  2. If there is a custom form region in the add in we need to specify separate registry keys as follows:
 
Under the IPM.Appointment key, string value of format ProgID.RegionName should be added. Value for this string should match with the new key added in the “AddIns” folder in 4th step.





Reference URL:

What is UNC path?

UNC stands for Universal/Uniform Naming Convention. A UNC path describes the location of a volume, directory, or file.
UNC is a naming convention used primarily to specify and map network drives in Microsoft Windows. UNC names are most commonly used to reach file servers or printers on a LAN.

The format for a UNC path is \\server\volume\directory\file and is not case-sensitive. For example:
\\Shared1_svr\Shared1\WGroups\Network\Orders.xls
Rather than describe the location of a file or directory by drive letter, the Network Group will typically communicate a UNC path to describe the actual location of a file or directory. Windows drive letter mappings are arbitrary, whereas a UNC path is specific and applies to all operating systems.

Reference URL: http://www.uwplatt.edu/oit/terms/uncpath.html