Walkthrough creating your first plugin
The following procedure will take you through creating a very simple plugin that utilizes the EmailTrackingRecipientMailboxesUpdating event context to set a custom ProjectNumber email property.
Creating the Custom Plugin Project in Visual Studio
- Open Visual Studio
- Create a new project using the C# Class Library project template. Ensure you change the .Net Framework selector to ".Net Framework 4"
- Give your plugin project a name
-
Delete the default Class1.cs file
- Add a new class file to the plugin project (this class will implement the custom logic for one of the plugin event contexts)
-
Provide a meaningful name for the class
-
Add a reference to the project to Scinaptic.OnePlace.API.dll
-
Right-click Project | Add Reference…
- Select the Browse option and navigate to the installation path of OnePlace Solutions (OnePlaceMail/OnePlaceDocs). By default this will be c:\Program Files (x86)\OnePlace Solutions
-
Add the following using statements to the top of class file
-
using Scinaptic.OnePlace.Core.API
-
using Scinaptic.OnePlace.Mail.API
-
- Change your class to implement the IPlugin interface
-
Right-click on the word IPlugin and use intellisense to Implement Interface.
- This should automatically create the methods that make up the IPlugin interface as shown below
-
Change the Name method to return a meaningful name of your plugin event
- The PerformAction method is where you write your custom code that will be executed by the product when the plugin event is triggered. We will write the code for the PerformAction method that creates a new custom email property to be set on the email called “ProjectNumber” and sets it to a random value. In practice, you could use the SharePointFileURL property to identify which project the email was saved to in SharePoint and then set the project number appropriately.
-
Building the solution will result a file called EmailTrackingServicePlugin.dll being created in the project bin directory under the active configuration (Debug or Release) directory. The referenced Scinaptic.OnePlace.API.dll file should also be present here.