mattermost-community / mattermost-outlook-presence-provider

A accompanying app to the Outlook Presence plugin

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Mattermost Outlook Presence Provider

Table of Contents

Overview

This app acts as an intermediary between Mattermost and Microsoft Outlook by getting users' status updates from Mattermost and using those statuses to display users' presence information in Outlook. It is created by following the official Microsoft documentation which can be found here. It is a Windows application that can be installed through a wizard setup.

Note: This application is tested to be working properly with MS Outlook 2016 and 2019.

Prerequisite

This plugin communicates with Mattermost through the Mattermost Outlook Presence Plugin. Please ensure this plugin is installed and enabled.

Installation

You can download the latest setup from the releases page. Extract the zip file after the download. Install the application by running the file setup.msi and following the instructions in the wizard. After the installation is complete, you can find a folder and a shortcut named Mattermost Presence Provider in the Windows Start menu that you can use to run the app. You can also run the app by going to the install location. The executable file that you have to run is MattermostPresenceProvider.exe. You need to do some configurations before running the app which you can find here.

Note: This application assumes that Skype for Business or Microsoft Teams is not installed in the user's system. If they are installed in the system, then this application may not work as expected.

Configuration

There's a config.json file present in the extracted zip folder which contains the configurations for the application. You can either configure it before installation or after installation. If you are configuring it after installation, then you'll have to modify the config.json file which is present in the install directory. The default install directory is "C:\Program Files\Mattermost\Mattermost Presence Provider" but it can be changed during the installation. The changes done in the config.json file present in the extracted zip folder will not affect the installed app. The following config settings need to be configured:

  • MattermostServerURL: The URL of the Mattermost server from which status updates need to be fetched
  • MattermostSecret: The webhook secret generated on the plugin settings page of the Mattermost plugin "Outlook Presence Provider". image
  • MattermostWebsocketReconnectionTimeoutInSeconds: The WebSocket client used in this app waits for messages from the server and if there is no message from the server in a certain interval, it disconnects and attempts to reconnect to the server. This config setting is for that certain interval. Its default value is 30 seconds but can be changed according to the needs.

Running the application

After the configuration, you can successfully execute the app by running the exe file. Go to the installed location of the app and run the MattermostPresenceProvider.exe (Or you can run it by using the shortcut in the Windows Start menu). After running it, check if it's running by opening the Task Manager and looking for "MattermostPresenceProvider" or you can also install additional applications to get more details about the processes running in your system like Microsoft's ProcessExplorer. If you see the app running, run Outlook and see the users' presence information in the small icons on their profile pictures or in the popovers which appear after hovering over them. ss

By default, this application is enabled for automatic startup when Windows starts. This means once you run the app manually, after that it will always be automatically started when Windows starts.

Note: You have to run the app by yourself for the first time.

Development

Setup

  • Install Visual Studio with the following workloads:
    • .NET desktop development
    • Universal Windows Platform Development
    • Office/SharePoint development
  • Install the extension Visual Studio Installer Projects by Microsoft. This will be needed to add and manage setup projects in Visual Studio.
  • Install the latest Windows SDK. The reason for installing Windows SDK is that it comes with the latest and original tools that we need. One of them is OleViewer which is very useful when working with COM. Another one is COMView. You can install either of them.

Basic Knowledge

The links above don't contain all the references required to completely understand this project but they are enough to give the required context of the project. More useful links:

Structure

The basic project structure was taken from a sample app provided in the Microsoft Community here. This project contains four separate projects embedded in one solution file.

  • OutOfProcessCOMBase: This project contains the Native code to run a COM server which was officially provided by Microsoft as a sample with the name "CSExeCOMServer" but later it was removed from the official Microsoft Github and was replaced by a new sample. We did not change anything in this project. This project compiles to a dll file which is used by the other projects.
  • MMPresenceProviderImpl: This is the primary project in which we have created classes that implement the interfaces exposed by the UCCollaborationLib namespace. This project contains all the logic to fetch and subscribe to users' status updates from Mattermost.
  • MMPresenceProvider: This project creates a Windows application (exe file) to run and it contains the other two projects as dependencies. Building this project automatically builds the other two as well. We can say that this is the startup project for our application. It contains the logic to register the Unified Collaborations API type library that is usually registered by Skype for Business/Microsoft Teams.
  • MMPresenceProviderSetup: This is just a setup project which creates a setup.msi file by building the MMPresenceProvider project.

Building the solution builds all these four projects. You can see how to build the solution in the CI yml file.

Logging

This project implements logging by creating a separate event log in the Windows Event Viewer. You can open the Event Viewer by following these steps. When the app is installed through the setup, a new event log named "Mattermost" and an event source "MattermostPresenceProvider" is created. Below is a screenshot of how the logs look in the Event Viewer. image

As you can see, all the logs are getting logged along with the timestamp and the level(Error and Information). This event log has a maximum size of 5MB and after that space is occupied, it starts overwriting the logs in the order of their timestamps. The oldest log is overwritten first. These settings can be changed after the app is installed by an admin. To do that, see this link. Also, these logs will not be visible after the app is uninstalled and the Event Viewer is restarted.

Continuous Integration (CI)

This project uses GitHub Actions for its CI/CD needs. You can look at the yml file here. The CI script explains the process of building this project in a whole new machine using Windows Powershell. It contains the following steps:

  • Set up Visual Studio with the VS Installer Projects extension. The action that is being used in the CI installs this extension by default.
  • Restore NuGet packages. You can either do it using Visual Studio or using CLI.
  • Then, we have to enable out-of-process builds in Visual studio as it does not support the building of projects outside Visual Studio processes. You can take a look at it here.
  • Then, we can build the solution using the devenv.com executable provided by Visual Studio using the Release configuration. Remember, the setup project MMPresenceProviderSetup will not be part of the build if you use the Debug configuration instead of Release.
  • Then, the CI script removes the unwanted files from the build directory and creates a zip of the build with the version number as a suffix followed by creating a GitHub release.

Made with ♥ by Brightscout

About

A accompanying app to the Outlook Presence plugin

License:Apache License 2.0


Languages

Language:C# 99.6%Language:VBScript 0.4%