Unknown error occurred while tracking email via CRM Outlook client

Seems that quite a lot of people have already experienced some kind of error with the CRM Outlook client. Today was one of those days again where I experienced an error. I did a clean install of the CRM 2011 Outlook client and connected to the CRM 2011 on premises environment. All seemed to be going extremely well. My contacts were being synchronized etc…

I wanted to track an email in CRM so I clicked the button “Track”. First a little pause and then boom, an error box popped up saying “An unknown error occurred while synchronizing data to Outlook.”.

ScreenHunter_09 Apr. 06 10.55

Ok not much to go with so I checked if there were any logs in the log directory: (“c:\Users\[USERNAME]\AppData\Local\Microsoft\MSCRM”)

No results there so I had to find a different solution to get some more information. I enabled tracing in Diagnostics tool that comes with the CRM 2011 Outlook client.

ScreenHunter_09 Apr. 06 12.56

Tried to track the email again to get that error box again and looked in the tracing file. (C:\Users\[USERNAME]\AppData\Local\Microsoft\MSCRM\Traces)

Now I did find something:

[2012-04-06 11:08:08.6] Process:OUTLOOK |Thread:5696 |Category: Unmanaged.Platform |User: PlatformUser |Level: Error | CMailItemHelper::HrRetrieveAndSetRegardingIdInOutlook File: c:\bt\32691\src\application\outlook\addin\emailhelper.cpp Line: 999
>hr = 0×80004004
[2012-04-06 11:08:08.7] Process:OUTLOOK |Thread:5696 |Category: Unmanaged.Platform |User: PlatformUser |Level: Error | CMailItemHelper::HrPromoteMailItemInCrm File: c:\bt\32691\src\application\outlook\addin\emailhelper.cpp Line: 1754
>hr = 0×80004004
[2012-04-06 11:08:08.7] Process:OUTLOOK |Thread:5696 |Category: Unmanaged.Platform |User: PlatformUser |Level: Error | CMailItemHelper::HrCreateInCrm File: c:\bt\32691\src\application\outlook\addin\emailhelper.cpp Line: 1406
>hr = 0×80004004
[2012-04-06 11:08:08.7] Process:OUTLOOK |Thread:5696 |Category: Unmanaged.Platform |User: PlatformUser |Level: Error | CMailItemHelper::HrCreateInCrm File: c:\bt\32691\src\application\outlook\addin\emailhelper.cpp Line: 1432
>hr = 0×80004004
[2012-04-06 11:08:08.94] Process:OUTLOOK |Thread:5696 |Category: Unmanaged.Platform |User: PlatformUser |Level: Error | CMailItemHelper::HrCreateInCrm File: c:\bt\32691\src\application\outlook\addin\emailhelper.cpp Line: 1452
>hr = 0×80004004
[2012-04-06 11:08:08.94] Process:OUTLOOK |Thread:5696 |Category: Unmanaged.Platform |User: PlatformUser |Level: Error | CMailItemHelper::HrCreateInCrm File: c:\bt\32691\src\application\outlook\addin\emailhelper.cpp Line: 1454
>hr = 0×80004004
[2012-04-06 11:08:08.95] Process:OUTLOOK |Thread:5696 |Category: Unmanaged.Platform |User: PlatformUser |Level: Error | CMailItemHelper::HrPromoteItemToCrm File: c:\bt\32691\src\application\outlook\addin\emailhelper.cpp Line: 243
>hr = 0×80004004
[2012-04-06 11:08:08.95] Process:OUTLOOK |Thread:5696 |Category: Unmanaged.Platform |User: PlatformUser |Level: Error | CItemHelper<struct Outlook::_MailItem>::PromoteItemToCrm File: c:\bt\32691\src\application\outlook\addin\ItemHelper.h Line: 354
>hr = 0×80004004
[2012-04-06 11:08:08.95] Process:OUTLOOK |Thread:5696 |Category: Unmanaged.Platform |User: PlatformUser |Level: Error | CSyncToOutlook::SyncItemByTypeByAction File: c:\bt\32691\src\application\outlook\addin\synctooutlook.cpp Line: 1451
>hr = 0×80004004
[2012-04-06 11:08:08.96] Process:OUTLOOK |Thread:5696 |Category: Unmanaged.Platform |User: PlatformUser |Level: Error | CSyncToOutlook::ProcessSyncResult File: c:\bt\32691\src\application\outlook\addin\synctooutlook.cpp Line: 1784
>hr = 0×80004004
[2012-04-06 11:08:08.97] Process:OUTLOOK |Thread:5696 |Category: Unmanaged.Platform |User: PlatformUser |Level: Error | CSyncToOutlook::ProcessSyncResult File: c:\bt\32691\src\application\outlook\addin\synctooutlook.cpp Line: 1831
>hr = 0×80004004
[2012-04-06 11:08:08.97] Process:OUTLOOK |Thread:5696 |Category: Unmanaged.Platform |User: PlatformUser |Level: Error | HrGetErrorDescription File: c:\bt\32691\src\application\outlook\addin\..\common\ResourceManagerEx.h Line: 148
>hr = 0×80004005
[2012-04-06 11:08:08.99] Process:OUTLOOK |Thread:5696 |Category: Unmanaged.Platform |User: PlatformUser |Level: Error | HrLoadManagedString File: c:\bt\32691\src\application\outlook\addin\..\common\ResourceManagerEx.h Line: 35
>hr = 0×80040203
[2012-04-06 11:08:08.99] Process:OUTLOOK |Thread:5696 |Category: Unmanaged.Platform |User: PlatformUser |Level: Error | LoadManagedString failed with hr = 0×80040203. Function: HrLoadManagedString File: c:\bt\32691\src\application\outlook\addin\..\common\ResourceManagerEx.h Line: 37
[2012-04-06 11:08:08.100] Process:OUTLOOK |Thread:5696 |Category: Unmanaged.Platform |User: PlatformUser |Level: Error | HrGetErrorDescription File: c:\bt\32691\src\application\outlook\addin\..\common\ResourceManagerEx.h Line: 154
>hr = 0×80040203

I’m just posing that long error message so that others with the same error will hopefully have something with this post.

So how did I fix this problem?

I though I was stuck because on the forums there wasn’t much information about this issue. Here’s what I did:

1) Go into control panel
2) Open Programs and Features
3) Select “Microsoft Dynamics CRM 2011 for Microsoft Outlook”
4) Click Uninstall/Change
5) Select Repair

ScreenHunter_09 Apr. 06 11.30

Hope this helps for you too!

Project setup for CRM 2011 custom workflow activity development

Today I wanted to create a custom workflow activity in code. I had some issues while creating and building this project in Visual Studio.By trial and error I slowly discovered what I was doing wrong. So here is you and for myself as future reference the setup of a CRM 2011 custom workflow activity.

1) Add XRM binaries from CRM 2011 SDK BIN folder. You need to add the following two:
- microsoft.xrm.sdk
- microsoft.xrm.sdk.workflow

2) These two assemblies have dependencies on System.ServiceModel and System.ServiceModel.Web so you need to add these too.
If you can’t add them, make sure that the target framework in you project properties is set to “.NET Framework 4″ and not “.NET Framework 4 Client Profile”

If you don’t add them then you’ll get build errors like:

- The referenced assembly “microsoft.xrm.sdk” could not be resolved because it has a dependency on “System.ServiceModel.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″ which is not in the currently targeted framework “.NETFramework,Version=v4.0,Profile=Client”. Please remove references to assemblies not in the targeted framework or consider retargeting your project.
- The referenced assembly “microsoft.xrm.sdk.workflow” could not be resolved because it has a dependency on “System.ServiceModel.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″ which is not in the currently targeted framework “.NETFramework,Version=v4.0,Profile=Client”. Please remove references to assemblies not in the targeted framework or consider retargeting your project.

3) Also add a reference to System.Runtime.Serialization if you are going to use an entities class generated by crmsvcutil.exe

Now you are finally set to start coding your custom CRM 2011 Workflow Activity Library…

4) Remove Activity1.xaml

3) Add a new C# class file to contain your custom workflow code

Once the workflow activity library is created…

5) Make sure to sign your assembly via the Project Properties / Signing tab

Custom workflow activity libraries need to be registered like a regular CRM plugin so…

6) Make sure you are a CRM 2011 deployment administrator otherwise you’ll not be able to register the plugin

Use the custom workflow activity in your CRM 2011 processes.