How to “connect with Outlook” on a custom contact list

This is a quick and dirty solution to make sure a custom contact list can connect with Outlook and that items are actually shown.

When making a custom contact list for a customer I took a contact list and added my custom contact content type to it and removed the original contact content type. To my regret it didn’t work. Either the “Connect to Outlook” button was greyed or when I did it programmatically the button was not greyed out but when viewing the list in Outlook it showed no items.

The best way to improve this functionality is to create your own STSSYNC connector. like described in this blog post

Connecting SharePoint Task Lists to Outlook Calendars

But that will take all day and for just adding maybe 1 or 2 columns it is a little bit of overkill.

The quick and dirty solution is to create a non-customizable (as it it now called in VS2012) contact list and a feature receiver on the feature that deploys the list. In this feature receiver you should add your custom fields and remove the fields you don’t need like in the next example.

SPField fieldManager= oWeb.Fields["Manager"];
oList.Fields.Add(fieldManager);

List<string> fieldsToDelete = new List<string>(new string[] { "Company Phonetic", "First Name Phonetic", State/Province", "Web Page", "Home Phone", "Last Name Phonetic", "Country/Region" });

            foreach (string field in fieldsToDelete)
            {
                SPField a = oList.Fields[field];
                a.AllowDeletion = true;
                a.Update();
                a.Delete();
            }

 oList.Update();

Now you can still use the “Connect to Outlook” button and the list items are shown in Outlook.

Of course your custom fields will not be shown in the Outlook contact. But if you use some of the other fields that are standard in the Core Contacts and Calendar Columns site columns then they do show up in the Outlook contact card such as “Other Phone”.

2 Comments

    • Hi Val,
      Yea this is from back in 2013. By now there are other solutions and this won’t even work in Office 365. But I don’t believe that the underlying code changed in either SharePoint or Outlook for that matter.
      The way I would approach this now is to have a custom Office Add-in. This add-in then can get contacts from everywhere and they don’t need to be in SharePoint either. The contacts can then come from any system as long as it can be accessed from through an API.

Leave a Reply

Your email address will not be published. Required fields are marked *