Exercise 1: Setting up your OSC Project
An OSC provider can be written using managed languages such as Microsoft Visual C# or Microsoft Visual Basic, or unmanaged languages such as Microsoft Visual C++. Any tool that can create a COM-visible DLL component can be used to develop an OSC provider. The decision to use a managed or unmanaged language to develop a provider should take into account the download size and dependencies of the provider installation package. In this exercise you will walk through the steps to setup and debug a test provider project. It is important to understand how to setup your project so that you can successfully debug it.
The steps for setting up a development environment vary slightly depending on your operating system and the bitness of Outlook (i.e. 32-bit or 64-bit). See
https://msdn.microsoft.com/en-us/library/ff759452.aspx for information applicable to other environments.
The steps in this lab assume that you are using a 64-bit version of Windows with a 32-bit version of Outlook.
Task 1 – Configuring the Project Settings in Visual Studio
In order to debug an OSC provider, it is important to configure your project correctly. Otherwise, it may be possible to run your solution, but it may never hit breakpoints in your code. In this task you will perform the initial project configuration settings to properly debug an OSC provider project.
- Run Visual Studio 2010 as administrator.
- Open the TestProvider solution.
- Select FileOpenProject/Solution
- Navigate to the TestProvider folder in your Student directory
Choose TestProvider.sln and click Open
Figure 1
Solution Explorer
- Briefly examine the project assets
- Notice the reference to OutlookSocialProvider. OutlookSocialProvider is the dll that defines the interface that your OSC provider needs to implement.
- The test provider returns static data to the OSC. See the XML files under Resources.
- TestPerson, TestProfile, TestProvider, and TestSession implement the required OSC interfaces.
- Build the solution by pressing F6
- Add Outlook to the solution. This is necessary for debugging purposes.
- Right-click on the TestProvider Solution (the top node in the Solution Explorer) and choose AddExisting Project
- Navigate to C:\Program Files (x86)\Microsoft Office\Office14 and select OUTLOOK.EXE.
- Click Open
- Right-click on the OUTLOOK solution in the Solution Explorer and choose Set as StartUp Object
- Right-click on the OUTLOOK solution again and choose Properties
- Set the value of the Debugger Type to Managed (v2.0, v1.1, v1.0)
- Select FileSave All
- Close the OUTLOOK properties window
- Verify Project Debug Settings. Prior to debugging, it is critical to verify that your debug settings match the platform on which you are debugging. If there is a mismatch here, your provider will not load in Outlook and you will not be able to debug.
- Right-click on the TestProvider solution (the top node in the Solution Explorer) and choose Configuration Manager
- Set the Active solution platform to Any CPU
- For the TestProvider project, set the Platform to Any CPU
- Click Close
- Right-click on the TestProvider project and select Properties
- On the Build tab, change the Platform target to x86 (the provider needs to match the bitness of Outlook).
Make sure that Register for COMinterop is checked.
Figure 2
TestProvider properties windows
- Select FileSave All
Task 2 – Registering the Provider
- Before you can debug your provider, you need to add some keys to the registry and register the assembly.
- Review registry key settings
- Using the Solution Explorer in Visual Studio, open up the file named registerProvider.reg in the TestProvider project
- Briefly make note of the registry keys required to register the provider
- Note that the entries at the end of the file for HKCU\Software\Microsoft\Office\Outlook\SocialConnector are not specific to the test provider. These keys enable OSC debugging in Outlook.
- Create registry keys
- Open up Windows Explorer
- Navigate to the project directory at C:\Student\OSC\TestProvider
- Double-click on the file registerProvider.reg to add the keys in the file to the registry
Task 3 – Unhiding the Hidden News Feed Folder
The OSC uses a folder named News Feed to store information related to status updates or news feeds. This folder is hidden by default. In order to debug an OSC provider, you need to unhide this folder. To do this, you will use the MFCMAPI tool. MFCMAPI is a low-level tool useful for troubleshooting Outlook and Exchange issues.
- Launch MFCMapi.exe which is located in the OSC directory. You can also download this tool from https://mfcmapi.codeplex.com/.
- Point to Logon and Display Store Table on the Session menu
In the store table list view, double-click the store that represents the default store for the profile.
To determine your default store, scroll to the right in MFCMapi until you see the heading PR_DEFAULT_STORE. This Boolean property will indicate which store is the default store.
- Expand the IPM_SUBTREE node.
- Click the News Feed folder under the root of IPM_SUBTREE.
- Double-click PR_ATTR_HIDDEN in the property list view for the News Feed folder.
Uncheck the Boolean check box to unhide the News Feed folder, and then click OK.
- Close out of the MFCMAPI tool.
Exercise 1 Verification
Now you have performed all the necessary steps to begin debugging your provider. To verify your work, perform the following actions.
- In Visual Studio, open the file TestProvider.cs
- Expand the region ISocialProvider Members
Add a breakpoint in the Load method
- Press F5 to debug the solution
Verify that Visual Studio stops at the breakpoint shortly after Outlook launches
Figure 6
Breakpoint on TestProvider.cs
- After your breakpoint is hit, press F5 to continue running the solution
- Close Outlook to stop debugging