Importing a SSIS package into SQL Server 2008

When automating data import into sql server, ssis is an easy and powerful way to accomplish the task.  Often, however the ssis package that you develop will be created on a local development machine, that you will save as a file on your system’s hard drive. To deploy the package to a production server you have several option, you can save the package on the hard drive of the production sql server and then reference the package on the sql server, or you can import the package in the sql server store. To accomplish these tasks, start the Management Studio and connect to the Integration Services instance on the SQL Server. Under “Stored Package”, you can import the ssis package you have created either storing it on the file system, or on server store. I am not sure of the benefits of choosing either at this point. I decided to store my package on the server store. Select import package, then select the package location (either another server or file location), select the package path and import it and you are good to go. From here you can reference the ssis package in a sql server scheduled job, and automate importing data to you sql server.

Enable smart tags in Outlook 2007 using C#

Recently I had to come up with a solution to the above dilemma, as it turns out enabling smart tags programmatically in outlook is quite the task. I was finally able to do it by modifying some registry keys for outlook, which are not that steight forward eaither. In essesnce its a two steps process: 

1. Under “Current User” in the registry (regedit util), access “Software\Microsoft\Office\Common\Smart Tag\Applications\OpusApp” and insert a new binary value. The name of the new entry should be “LabelText” and its value should be “01 00 00 00″ or 64 in decimal.

2.  This step is a bit trickier. We need to edit the Outlook default editor settings in the registry. For outlook 2007 the default editor is always Word. So find this key: “Software\Microsoft\Office\12.0\Word\Data” in the registry, we will need to edit the 334 and 519 bytes. When smart tags are enabled the 334 byte is incremented by 1 and the 519 byte is incremented by 128.

3.  The whole process needs to be completed while outlook is not running.

Below is a sample consol app that enables smart tags for outlook.



static void Main(string[] args)
  {

   try
   {
    //Close Outlook
    Process outlook = Process.GetProcessesByName("OUTLOOK").FirstOrDefault();
    MessageBoxResult result = MessageBoxResult.Cancel;
    if (outlook != null)
    {
     result = MessageBox.Show
       (
         "Outlook is running. Outlook will be closed for the installation to complete!",
         "Outlook running",
         MessageBoxButton.OKCancel,
         MessageBoxImage.Exclamation,
         MessageBoxResult.OK
        );
     if (result == MessageBoxResult.OK)
     {
      if (!outlook.CloseMainWindow())
      {
       outlook.Kill();
      }
      outlook.WaitForExit();
     }
     else
     {
      throw new Exception("HEI Smart Tags Installation failed because Outlook is running. Close Outook and try to install again.");
     }
    }

    if (result == MessageBoxResult.OK)
    {
     outlook = new Process();
     outlook.StartInfo = new ProcessStartInfo("OUTLOOK");
     outlook.Start();
    }

    EnableSmartTags();

   }
   catch (Exception ee)
   {
#if DEBUG
    Console.Write(ee);
#endif
   }
  }

  private static void EnableSmartTags()
  {
   RegistryKey word = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Office\Common\Smart Tag\Applications\OpusApp", true);
   if (word == null)
   {
    Registry.CurrentUser.CreateSubKey(@"Software\Microsoft\Office\Common\Smart Tag\Applications\OpusApp");
    word = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Office\Common\Smart Tag\Applications\OpusApp", true);
   }
   bool isSmartTagEnabled = word.GetValue("LabelText") == null;
   word.SetValue("LabelText", new byte[4] { 1, 0, 0, 0 }, RegistryValueKind.Binary);
   word.Close();

   ///To Properly enable smart tags in Outlook, couple of bytes need to be set to a specific value
   ///The key location is:Software\Microsoft\Office\12.0\Word\Data\fs
   ///and the value entry is:SettingsWordMail
   ///In the byte array
   ///the 334 byte needs to be incremented by 1 to enable smart tags and
   ///the 519 byte needs to be incremented by 128 to enable smart tags
   ///double check not to overflow the 519 byte.
   RegistryKey worddata = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Office\12.0\Word\Data", true);
   if (worddata != null)
   {
    byte[] wordEmailSettings = worddata.GetValue("SettingsWordMail") as byte[];
    //Outlook
    if (!isSmartTagEnabled)
    {
     //Check if the bit will overflow
     if (wordEmailSettings[519] < = 128)
     {
      //This byte should not be incremented if the second byte is not updated
      wordEmailSettings[334] += 1;
      wordEmailSettings[519] += 128;
     }
    }
    //Outlook
    worddata.SetValue("SettingsWordMail", wordEmailSettings, worddata.GetValueKind("SettingsWordMail"));
    worddata.Close();
   }

 

Hopefully this little hack will save someone else some time and effort out there.

 

Return top

INFORMATION

Change this sentence and title from admin Theme option page.