Custom properties in Outlook Mobile

As part of my plan to write a location-based reminder app using Bluetooth devices, I need a way to assign tasks to people, and people to specific Bluetooth device IDs.

I’ve decided to do this using custom properties in Outlook Mobile – the default PIM that comes on all Windows Mobile smartphones and PDAs.

I’ve not used this API before, but after a little playing, I’m impressed with how straightforward it all is.

The idea is that items in the Outlook Mobile PIM have pre-defined properties – so Contacts have fields such as ‘First Name’, or ‘Postcode’. But you can programmatically add new fields, and then store whatever you want in them.

For my purposes, I can add a “Bluetooth Device IDs” property to Contact items in my address book. I can also add pointers to Contact items to Task items in my to do list.

As this is just meant as a quick hack / proof-of-concept, I’m doing this in C#. The code looks something like this:

using Microsoft.WindowsMobile.PocketOutlook; 

public void SetContactCustomProperty(Contact outlookContact,  
                                     string customPropertyName,  
                                     string customPropertyValue) 
  if ((outlookContact.Properties.Contains(customPropertyName) == false) ||  
      (outlookContact.Properties[customPropertyName] == null)) 
    outlookContact.Properties.Add(customPropertyName, typeof(string)); 

  outlookContact.Properties[customPropertyName] = customPropertyValue; 


public string GetCustomContactProperty(Contact outlookContact,  
                                       string customPropertyName) 
  if (outlookContact.Properties.Contains(customPropertyName) == false) 
    return null; 

  return outlookContact.Properties[customPropertyName]; 

For my purposes, I want to store strings, but it’s not limited to that – you can store other data types.


I’ve come across a couple of limitations.

Firstly, custom properties do not show up in the Outlook Mobile apps. They’re stored in the underlying PIM database, but they’re not exposed to the user by the core PIM apps.

In the full desktop Outlook, you can easily modify Forms to add controls for custom fields, and there is also a ‘View all fields’ view as a last-resort. But you can’t do this in Outlook Mobile.

It’s a shame – I wanted the user to be able to specify Bluetooth Device IDs from within the Address Book, and to be able to assign tasks to people from within the Task list. But to do this, I’m gonna need to write a DLL in C++ to extend the core PIM apps. I’ve done this before, but it’s fiddly and time-consuming and I’m not in the mood to fight with that tonight.

For now I’m just gonna have to create a new stand-alone interface for managing and displaying the pairings. A bit clunky. 🙁

Secondly (and more annoyingly!), custom properties are not sync’ed to the desktop Outlook by ActiveSync. I’ve experimented with making changes on Outlook Mobile, but none of these have shown up in the desktop Outlook.

I wanted the user to be able to maintain assignments of people to mobiles, and people to tasks from their desktop. But it looks like to manage that, I’d have to write my own ActiveSync conduit to manually synchronise any custom fields. This is uber-fiddly, and I really can’t be bothered to fight with that.

So for now, this is going to be a mobile-only application. It’s not a major problem – custom properties in Outlook Mobile are persisted fine after synchronisation of changes on either desktop or mobile. But even so… desktop Outlook has support for custom fields, Outlook Mobile has support for custom properties… it’d be really nice if ActiveSync could sync between the two!

Tags: , , , , , , ,

6 Responses to “Custom properties in Outlook Mobile”

  1. […] dale lane fan of all things mobile, father of small girls, IBM code monkey, youth charity trustee… « Custom properties in Outlook Mobile […]

  2. […] the original post: Custom properties in Outlook Mobile Filed under: Task Lists, advertising, consumerist, defamer, dirt-sandwich, download, downloads, […]

  3. Another limitation with custom properties is that atleast on Windows Mobile 5.0 many of the built in PIM apps don’t persist them when you cut/copy/paste items.

    For example create an appointment (either manually or via code) and attach some custom properties. Then go into the Calendar application and use the cut and paste menu options to move the appointment to another timeslot.

    You’ll notice that all of your custom properties get removed in the process. This limits the practicality of custom properties in some situations.

  4. There’s a Medical History example available on MSDN at that shows Microsoft’s suggested way for presenting a custom UI to interact with custom properties.

    Essentially they suggest doing something similar in principal to your Pocket Internet Explorer menu extensions and presenting a separate dialog for the custom properties.

  5. dale says:

    That’s annoying. Seems like such an easy thing for MS to fix, too.

    Thanks for the heads up!

  6. mizyeh says:

    Yes , we all need custom properties sync’ed between desktop and mobile.