Rss 2.0 via FEED
Ken Hughes... - Outlook
Productivity, Technology and Automating Everything...
    
 

 image I've been toying around with creating an Outlook addin recently that adds a new panel to the main Outlook inspector window. Actually it is going to be a 'folding' or 'collapsing' windows similar to the docked ToolWindows in Visual Studio.image

Anyway, the stuff around getting the correct window handle for the Outlook inspector window and resizing it to allow some space to insert my new panel was fairly simple, but I also had to hook into the message look of the window so that I could capture any move or resize messages and so resize things again to accommodate my panel.

I had started developing it as an Outlook add-in but to speed things up (and prevent me having to register / unregister the addin between tests etc I decided to develop it as a separate app- I could still hook into Outlook and move things around.

The problem came when I was trying to hook the inspector window message loop - it didn't seem to work. I fired up Spy++ and check that the inspector window was getting the messages - which it was - but they were never getting delivered to my hook code.

I was using System.Windows.Form.NativeWindow and overriding the WndProc function (see my NativeWindowListener class below). To get the hook in place I was creating a new NativeWindowListener class with the inspector window handle as the parameter. Checking the handles and the delegates etc it all seemed to be correct, I just couldn't fathom why it wasn't getting any of the messages.

Then the penny dropped. Outlook is in a separate process... (NativeWindow only works across the current process and window handles that are contained in it). What would be needed in this case is a system wide hook, that requires use of the Win32API and interop. I reckon this is overkill just to save a bit of development pain, so will probably move to something where the Outlook addin dynamically loads the panel in and make something available to have the add-in reload the panel - this should allow me to develop the panel code (the majority of the app) without worrying to much about the Outlook addin side of things.

using System;
using System.Windows.Forms;
using System.Text;

namespace Outlook_Subclasser
{
[System.Security.Permissions.PermissionSet(System.Security.Permissions.SecurityAction.Demand, Name = "FullTrust")]
internal class NativeWindowListener : NativeWindow
{

    // Constant value was found in the "windows.h" header file.
    private const int WM_SIZE = 0x0005;

    public NativeWindowListener(IntPtr handle)
    {
        AssignHandle(handle);
    }

    [System.Security.Permissions.PermissionSet(System.Security.Permissions.SecurityAction.Demand, Name = "FullTrust")]
    protected override void WndProc(ref Message msg)
    {
        switch (msg.Msg)
        {
            case WM_SIZE:
                // do your processing in here
                break;

            default:
                break;
        }
        base.WndProc(ref msg);
    }
}
}

and then to use the class you would find the handle of the window you want to subclass and create a new NativeWindowsListener passing in that handle to the constructor. Note - this does not cover a number of aspects around releasing handles etc - you will want to make sure these are covered off...

MyForm myForm = new MyForm();
NativeWindowListener nwl = new NativeWindowListener(myForm.Handle);

 

GEO 51.4043197631836:-1.28760504722595

Posted: Friday, January 16, 2009 5:06:21 PM (GMT Standard Time, UTC+00:00)  #   Comments [0]
TAGS: .NET | C Sharp | Development | Outlook | Software

I've had a lot of interest in my SMS Gateway app since this post. SMS gateway consist of two components :

SMS Gateway Addinimage
This is an Outlook addin that adds a new toolbar to your Outlook instance. The toolbar allow the user to choose a mobile / cellphone number (from their contacts) and enter a message. When they hit the enter key after the message (or click 'Send') a new Task is created when has a subject of 'SECRETCODE' and the mobile / cellphone number and the details being the text of the message.

At some stage this Outlook Task is synchronized (over ActiveSync / Direct Push) to a Windows mobile device...

SMSGateway
This is a small app running on a Windows Mobile device that every 15 seconds checks through the tasks. If it finds any tasks that have a subject beginning with SECRETCODE then it parses out the mobile / cellphone number and sends the message text (from the Task details) to that mobile / cellphone number via SMS. Note: the SECRETCODE word is configurable.

imageWhy develop this ?
The purpose of this app was really to allow me to send SMS messages easily from Outlook without having to sign up for (and pay for) a web to SMS service (I already get 100's of free SMS messages with my mobile / cellphone package).

The application is free for anyone to use (drop me a line - in the comments - if you do use it...)

Windows Mobile CAB file (copy the file to your Windows Mobile device and click on it) : SMSGatewayMobile.CAB
Setup file for the Outlook 2003 Add-in (Outlook 2007 coming soon) : SMSGatewayAddin2003.msi
Source for both the applications : SMSGateway.zip (includes test Outlook 2007 addin code)

I'd be really interested to hear from anyone using this.... post in the comments...

GEO 51.4043197631836:-1.28760504722595
Posted: Friday, January 09, 2009 10:29:30 PM (GMT Standard Time, UTC+00:00)  #   Comments [4]
TAGS: .NET | C Sharp | Development | Outlook | Software | Windows Mobile
 image

Recently I have wanted to be able to send SMS messages to my contacts without having to pick up my phone and mess around with the mini keyboard (I wanted to do it directly from PC, but have the message still send by the phone...

There are solutions around that allow you to send a SMS from a form on a web page, but these are generally paid for services or limited to XX messages per day - I have a mobile contract with unlimited texting, so why would I want to pay for another service, and I didn't want to be limited in the volume of texts I can send per day. there are also solutions around that require the device to be docked / plugged into the PC, I didn't like this either as it's just too much hassle (and therefore I never do it)...

So I came up with a simple but effective solution that makes use of ActiveSync / push email technology that is built into Windows Mobile devices.

Basically I wrote an Outlook Addin that allows me to choose a contact from a drop down list, type in the message and "send" it - when I say "send" it, what I mean is the request is transferred to the WM6 device which then sends the actual SMS message.

image

So it goes like this :-image

  • User chooses the contact from a  drop down list of all contacts with mobile numbers.
  • User enters the text of the message
  • User clicks send
  • Outlook Addin creates a new task with a secret keyword followed by the mobile number as the subject and the message in the body of the task.
  • (after a few seconds) the new task is synchronized to the WM6 device via push email / ActiveSync
  • WM6 device regularly checks the tasks list for a task with a subject that starts with the secret keyword 
  • The subject line is parsed to get the mobile number the text is to be sent to
  • The body is parsed to get the text of the message
  • A SMS message is send from the WM6 device.
  • The new task is deleted (or marked as complete)
  • The change to the task (delete or marked as complete) is synchronized back to the PC via ActiveSync / push email.

I'll have more details, the installers and all the source code available next week...

 

UPDATE: See the follow up to this article here which includes binary files and full source code.

 

GEO 51.4043197631836:-1.28760504722595
Posted: Thursday, October 02, 2008 10:40:26 PM (GMT Daylight Time, UTC+01:00)  #   Comments [3]
TAGS: .NET | C Sharp | Development | Outlook | Windows Mobile

OutlookIMAPFoldersNow that I have moved us over to Google Apps For Your Domain (GAFYD) completely, I have been fighting with Outlook to get a decent user / email experience.

It just doesn't seem to flow well - I got the SMTP/IMAP send/receive stuff all set up and working correctly, but it's clunky.

I have all the folders appearing in my Outlook client but the UX just does not flow - in order to LABEL a email (in google terms) I have to move it to a folder named as the LABEL I want to apply (if I want to label it 'Outdoor' I simply move it to the 'Outdoor' folder). Equally, anything I have labelled will be visible in that folder (if I labelled it 'Outdoor' then it'll be in my 'Outdoor' folder).

There are plenty of sites with step by step guides for configuring Outlook with GoogleMail, so I wont go into that but I will share this tip:

To download full emails (not just headers) you need to do the following :-

  • Tools -> Send/Receive -> Send/Receive Settings -> Define Send/Receive Groups...
  • Select the group your IMAP account is in (typically 'All Accounts')
  • Click 'Edit'
  • Select the account if there is more than one
  • Select the option for 'Download complete items' (this is different for OL2003 and OL2007, below is OL2003)

OutlookIMAPDownload

 

However the biggest pain with Outlook is that it does not by default open in any account that does not have the usual default folders (Contacts, Calendar, Inbox etc).

As a Google IMAP account does not have these it automatically adds a 'Personal Folders' PST file and opens at the Inbox folder folder of that instead.

I am pretty much settled on letting OL grab a copy of my mail (just in case I need to edit offline), but am finding myself using Google's web mail interface most of the time.

GEO 51.4043197631836:-1.28760504722595
Posted: Wednesday, June 25, 2008 1:24:06 PM (GMT Daylight Time, UTC+01:00)  #   Comments [0]
TAGS: Outlook | Web

Just changed all my email / calendar stuff to Google Apps for Your Domain (GAYD). It was a breeze to do, took around an hour all in and now all email access is IMAP and Web.

The reason I chose this setup was so that all email and calendar data is stored by google, which is much less likely to loose data that I am (HDD crash, theft, fire, flood etc).

As part of the reconfiguration I changed my usual mail IMAP settings on my WM6 device (Pocket Outlook). After changing all the settings I was surprised to find that it simply didn't work.
After much trial and error I found that WM6 didn't seem to want to swap from non SSL connections for SSL connections.

The 'fix' was simply to delete the original account and then create a brand new one. All is fine and dandy now...

GEO 51.4043197631836:-1.28760504722595
Posted: Monday, May 26, 2008 7:41:09 PM (GMT Daylight Time, UTC+01:00)  #   Comments [0]
TAGS: Outlook | Windows Mobile

Today, I wanted to configure an Outlook 2007 rule to process RSS items as they are received. By process I mean I wanted to check for attachments/enclosures, if it had any MP3s attached/enclosed then save them to a folder on my desktop (that way I simply sync my Creative Zen Vision: M with the desktop folder and I have all my podcasts available for my commute).

 I could not seem to get the Outlook rules engine working correctly on RSS feeds, I wanted to run a script (a function I'd written in Outlook VBA) that was executed every time I receive a RSS item.
The 'Run A Script' action in the rules wizard will only list subroutines with a signature like this:

Sub Foo(objItem As MailItem)

(Of course the subroutine name doesn't matter...)

Anyway this doesn't work for RSS items as their message class is IPM.Post.RSS (making them a PostItem object). So this is a bit of a pain and means I cannot process RSS items using a rule.
In the end I had to use the following code to do it - I just open the folder of the RSS feed and run this (via a custom toolbar button) and it does it all for me.

Public Sub SaveRSSEnclosures() Dim att As Attachment, objList As Object, objItem As Object, iCount As Integer Set objList = Application.ActiveExplorer.CurrentFolder.Items iCount = 0 For Each objItem In objList If (objItem.Attachments.Count > 0) And (objItem.UnRead) Then ' iterate through looking for .mp3's For Each att In objItem.Attachments If LCase(Right(att.FileName, 3)) = "mp3" Then ' save it att.SaveAsFile ("c:\Users\kenh\desktop\podcasts\" & att.FileName) iCount = iCount + 1 End If Next End If Next If iCount > 0 Then MsgBox "Saved " & iCount & " mp3 items" End Sub
Posted: Wednesday, February 21, 2007 6:13:07 PM (GMT Standard Time, UTC+00:00)  #   Comments [0]
TAGS: Outlook | RSS | Scripting

I have been using the new RSS feed feature in Outlook 2007 for some time now and absolutely love it - I'm in Outlook ALL day, it's the centre of my communication universe and having it collate my RSS feeds just makes sense.

I'm a regular listener to a few podcasts :

and until today TechNet Radio...

I have Outlook set to download enclosures automatically (so for the podcast shows I get the MP3 directly into my mailbox. Whilst this bloats my mailbox (as you'll see later) I work for an Email Archiving company (C2C) and my RSS feeds folder has an 'older than 21 days and is read' policy applied to it. We are also about to extend support for the RSS items making it even easier to identify them in a policy.

Anyway, today I got very annoyed with TechNet Radio. On looking at what I thought was new items in that feed I found that it was downloading all the feed items again (the same one's I already have). My status bar tells me that it's got 498MB to update  and it's going to take 8 hours.

On looking further I find that I already have 4 copies of most of this stuff...

So I go ahead and delete all the duplicates then examine the size of my 'Deleted Items' folder.

Almost 1.5GB

Okay, had enough ditch it all and delete the feed.

I mean, come on guys, what is going on - no one else gives me this hassle, the Pwop Productions guys (Hanselminutes and DotNetRocks) are fine, as is The MicroISV Show - never any errors or duplicates - and there MP3 have intelligent tags, like the name of the show and/or guest names instead of something like :

TechNet Radio - 21 December 2006

and their's is tagged with a Genre of Podcast not just left blank...

End of rant, end of my subscription to TechNet Radio.

Posted: Monday, February 19, 2007 10:55:34 PM (GMT Standard Time, UTC+00:00)  #   Comments [0]
TAGS: Outlook | RSS

This week (so far) has been good - in terms of completing things, productivity and new products.

First off, Microsoft finally released PowerShell for Vista. No more having to 'play' on my old lab machine to get to grips with this stuff. There seem to be a number of people reporting failed installs(due to EFS encryption being disabled), just read the comments of the PowerShell blog announcement.

Next, we're just coming to the final couple of days of a 'Supporting Exchange 2007, Office 2007 and Vista SPRINT' at work (we use a form of SCRUM as our development process) - all is looking good and we have beta sites lined up.

Then, I noticed Eileen's (the most communicative Microsoft employee on the planet) post about Office 2003 to Office 2007 command references. An interactive demo from Microsoft when you can click the toolbars and menus of an Office 2003 application and it tells you how to find the equivalent command/function in Office 2007. I spent some time finding the 10 or so commands I'd been having difficulty with and increased my productivity.
Here's her post : http://blogs.technet.com/eileen_brown/archive/2007/01/31/old-to-new-reference-guides.aspx

Then late last night (again at work) we just completed our internal testing before sending our Archive One product for Microsoft Platform testing. We are testing against 5 of the 6 platform tests (we don't fit into the 'Managed Code' test category as we make extensive use of MAPI which basically requires C++ / Unmanaged code)

Posted: Thursday, February 01, 2007 10:42:07 AM (GMT Standard Time, UTC+00:00)  #   Comments [0]
TAGS: Archiving | Development | Exchange | Outlook | Scripting | Software | Technical | Tools

I always try to keep my Inbox at a manageable level (for me that is less than 50 items). Everything that I have dealt with (or I need for reference) I file in a specific reference folder

ASIDE: I know Getting Things Done, GTD, advocates just deleting it but I'm one of those guys that doesn't like to delete anything - I have no mailbox quota as we dogfood our own Archiving / Mailbox size control application, Archive One (shameless plugging).

Anyway, when the method I used for filing was to assign each email a category (or multiple categories) and then run an Outlook macro to copy it to a folder with the same name as the category. In Outlook 2003 assigning a category was a bit of a pain / lengthy process so I wrote a bunch of macros to automate this from the click of a single toolbar button.

Now I have Office 2007, assigning categories is much simpler, so I ditched the 'Assign Category XXX' macros and just wrote 'FileBasedOnCategory' macros. I needed one to process just the selected item and another for processing all items in my Inbox.

Now categorizing is a simple right click and select and storing a single toolbar button away...

 

 Here's the macros I wrote:

Public Const ReferenceFolder = "zz Reference" Public Sub CategorizeThis() ' Assign a category to the selected objects Dim sCurrent As String, obj As Object, objList As Object Set objList = Application.ActiveExplorer.Selection For Each obj In objList StoreObject obj Next Set obj = Nothing Set objList = Nothing End Sub Public Sub CategorizeAll() ' Assign a category to the selected objects Dim sCurrent As String, obj As Object, objList As Object Set objList = Application.ActiveExplorer.CurrentFolder.Items For Each obj In objList StoreObject obj Next Set obj = Nothing Set objList = Nothing End Sub Private Sub StoreObject(ByRef obj As Object) Dim vCat As Variant, aCats() As String, o As Object, sFolder As String, bOK As Boolean bOK = True If obj.Categories <> "" Then aCats = Split(obj.Categories, ",") For Each vCat In aCats() sFolder = ReferenceFolder & "\" & Trim(CStr(vCat)) If CreateMAPIFolder(sFolder) Then Set o = obj.Copy o.Move GetMAPIFolder(sFolder) Else MsgBox ("Could not create folder : " & sFolder) bOK = False Exit For End If Next If bOK Then obj.Delete End If End Sub Private Function CreateMAPIFolder(ByVal sFolder As String) As Boolean ' Create a MAPIFolder object of the specified name if none exists Dim objNS As NameSpace, objParent As MAPIFolder, objChild As MAPIFolder Set objNS = Application.GetNamespace("MAPI") Set objParent = objNS.GetDefaultFolder(olFolderInbox) Dim aFolders() As String, vFolder As Variant aFolders = Split(sFolder, "\") For Each vFolder In aFolders On Error Resume Next Set objChild = objParent.Folders(Trim(CStr(vFolder))) If Err Then Set objChild = objParent.Folders.Add(Trim(CStr(vFolder))) Err.Clear Set objParent = objChild Next If (InStr(objChild.FolderPath, sFolder) > 0) Then CreateMAPIFolder = True Else CreateMAPIFolder = False End If Set objParent = Nothing Set objChild = Nothing Set objNS = Nothing End Function Private Function GetMAPIFolder(ByVal FolderName As String) As Object ' Returns a MAPIFolder object of the specified name Dim objNS As NameSpace, objParent As MAPIFolder, objChild As MAPIFolder Set objNS = Application.GetNamespace("MAPI") Set objParent = objNS.GetDefaultFolder(olFolderInbox) Dim aFolders() As String, vFolder As Variant aFolders = Split(FolderName, "\") For Each vFolder In aFolders Set objChild = objParent.Folders(CStr(vFolder)) Set objParent = objChild Next Set GetMAPIFolder = objChild Set objParent = Nothing Set objChild = Nothing Set objNS = Nothing End Function

Posted: Friday, December 08, 2006 6:46:36 PM (GMT Standard Time, UTC+00:00)  #   Comments [0]
TAGS: Outlook | Scripting

I am/was a big fan of RSS Popper - when using Outlook 2003 it allowed me to pull blog posts into a selected folder in my mailbox (I used cached mode, so it was also available offline). It is currently at version 0.36 and has support for downloading enclosures (great for grabbing podcasts) and a neat feature where you can subscribe to blogs containing iCal's (and RSS Popper automagically creates meetings in your calendar for the iCal events - sounds really cool, nothing that I've ever used though).

Anyway, I've migrated my work laptop to Vista and Office 2007 and as Outlook 2007 has built in support for RSS feeds I've not installed RSS Popper. The RSS support in Outlook (apparently) based around the new Common Feed Store of Vista - this allows multiple apps to access / store your chosen RSS feeds, for example if I mark the post as 'Read' in IE7 then that fact is reflected when I look at it in Outlook RSS.

It's pretty simple to define new feeds - it's accessed from 'Tools -> Account Settings...' and is configured in much the same way as you configure an email account.

 



 Items are added to the defined folder as posts with any enclosures added as attachments to the post.

Posted: Monday, December 04, 2006 4:20:29 PM (GMT Standard Time, UTC+00:00)  #   Comments [0]
TAGS: Outlook | RSS | Software

I'm very impressed with the improvements in Outlook 2007.

The ToDo bar is proving a real godsend - it can (optionally) display a calendar (one or more months), appointments (fill the remaining space in the ToDo Bar or a only a fixed number of appointments, and Tasks.

Left is a screen shot of mine with one calendar month and the rest filling up with appointments.

It can get to be a bit too much data, especially if you have a couple of days with just one or two appointments then the eight or ten it displays (on my 1280 * 800  12.1" laptop screen) can cover a whole week and it';s not easy to see how it splits down into days - be nice to see this somehow color coded so that each day is a different color...

I am also loving the category features - tagging a mail with a articular category is now a simply right click in the 'category' field (if you have it displayed) or a single left click to tag it with the 'default category'

I use categories to do all my filing (in a Frankenstienish Getting Things Done kind of personal prductivity scheme) so this really speeds me up.
I used to have about 12 common categories as macro buttons to allow me to do this, thats all superceded now... My whole custom filing/ GTD scheme is a single macro to explore the categories of an item and move the item into a folder of that (category) name - much easier.

You do lose a lot of real estate to the ribbon bar when composing messages though..

Do people really need that level of document editing / markup when composing messages ??

 

Posted: Wednesday, November 29, 2006 10:04:01 PM (GMT Standard Time, UTC+00:00)  #   Comments [0]
TAGS: Outlook | Software

If you want to move ALL calendar items from an Outlook calendar in one mailbox to an Outlook calendar in another mailbox - it's not immediately apparent how to go about this.

You can simply copy it over giving it a new name (not Calendar) but then you end up with 2 calendars and it becomes messy. Also, you cannot delete the Calendar in the destination mailbox and copy the source one over (Outlook does not allow this)

So...

  • Click on the Calendar folder
  • From the 'View' menu choose 'Arrange By' , 'Current View' , 'By Category'

You should now end up with a table view of all your appointments...

  • Click on the first item in the list
  • Scroll down to the bottom of the list
  • Hold down 'SHIFT' and click on the last item (NOTE: Select All (CTRL A) does not work)
  • Drag all the selected items into the destination Calendar.
Posted: Friday, October 06, 2006 11:01:15 AM (GMT Daylight Time, UTC+01:00)  #   Comments [0]
TAGS: Outlook
     
 
 
Copyright © 2009 Ken Hughes. All rights reserved.

Creative Commons License
This work is licensed under a Creative Commons Attribution 2.0 UK: England & Wales License.