Connector for Microsoft Exchange in processes

General
Groovy

How to configure a connection to Microsoft Exchange in Intrexx can be found here.
Information regarding Microsoft Exchange data in Intrexx applications can be found here.

General

Access to the objects on the Exchange server can also be realized using processes. This is divided into the following scenarios:

Use as interactive user

A process will be initiated through an arbitrary initiating data record event and will then start the corresponding actions. In this case, the process can access the mailbox of the currently logged-in user exclusively.

Use with timer events

In the case of timer events, there are no interactive users. In this case, an easy-to-use dialog allows a predefined user to be selected, in the user context of whom the Exchange server will execute the desired further workflow actions.

If this user has appropriate permissions to public mailboxes, corresponding actions can also be executed in these mailboxes. Such actions can be those such as creating a task or an appointment.

This makes it possible, for example, for employees to be directly assigned tasks or appointments for customer visits, reminders, etc. from the customer management system itself. With the real-time access to the Exchange server, all appointments will always be at the most current status.

If the Process Manager has recognized the selected data group as a connection to the Exchange server, a user can then be defined in this dialog, in the context of whom the queries will be executed.



With the Login as static user option, the Select user link will be activated. Clicking on this link opens a dialog that allows users from the data source configuration that have been created and assigned to Exchange users to be selected. In the lower area, enter the desired connection data to the Exchange server.

With the option User from system value, the system value has to contain a user GUID. Please note that a valid user mapping has to be existing in the Exchange configuration (additional users). Click on Edit system value for defining the system value in the following dialog.

Furthermore, the actions of the Process Manager can of course create appointments, tasks and emails. With the User switch action users can be switched during the process.

If a static user is assigned within the data group, as well as to the process, the user of the data group has priority.

A user who publishes a process with a user switch action must possess sufficient permissions to do so. Normally, the user will inherit sufficient rights from belonging to the Administrators user group.

Groovy

In the library, a number of classes and methods are available in the Exchange category that can be used in the environment of Groovy. Here are a number of examples in brief:

Save an email locally

import de.uplanet.lucy.server.businesslogic.exchange.util.ExchangeUtils
				
def strMessageId   = g_request.get('qs_id')
def msgUtil        = ExchangeUtils.getMessageUtil()
def strHref        = msgUtil.getHrefById(strMessageId)
def mailboxUtil    = ExchangeUtils.getMailboxUtil()
def strMailBoxName = mailboxUtil.getUserAccount(g_session?.user?.guid).exchangeMailbox
def strMailName    = strMessageId[strMessageId.lastIndexOf("-") + 1..-1]
def mail           = new File("C:/${strMailName}.eml")
				
msgUtil.saveMessageAsEML(strMailBoxName, strHref, mail)

Save an email via FileUCHelper in an Intrexx data group


import de.uplanet.lucy.server.businesslogic.exchange.util.ExchangeUtils
import de.uplanet.lucy.server.businesslogic.util.FileUCHelper

def conn = g_dbConnections.systemConnection

def strMailBoxName = "ExTest.2"
def strMessageId   = g_request.get('qs_id')
def msgUtil        = ExchangeUtils.getMessageUtil()
def strHref        = msgUtil.getHrefById(strMessageId)

def strMailName = strMessageId[strMessageId.lastIndexOf("-") + 1..-1]
def mail 	    = new File(g_dirWorkflowTmp, "${strMailName}.eml")

msgUtil.saveMessageAsEML(strMailBoxName, strHref, mail)

def iMaxLid = g_dbQuery.executeAndGetScalarValue(conn, "SELECT MAX(LID) FROM XDATAGROUP445CAD5D", 0)

g_dbQuery.executeUpdate(conn,
"INSERT INTO XDATAGROUP445CAD5D (LID) VALUES (?)")
{
	setInt(1, iMaxLid + 1)
}

FileUCHelper.moveFileToIntrexx(g_context, mail, "353CB9686F4FF3CAC9FD8894AAC7C9611BA58625", iMaxLid + 1, "${strMailName}.eml", false)

Create new folder

import de.uplanet.lucy.server.businesslogic.exchange.util.ExchangeUtils

def mailboxUtil         = ExchangeUtils.getMailboxUtil()
def strParentFolderName = g_request.get("qs_parentFolder")
def strNewFolderName    = g_request.get("qs_newFolder")

mailboxUtil.createFolder(strNewFolderName, strParentFolderName , "urn:content-classes:mailfolder")

Rename existing folder

import de.uplanet.lucy.server.businesslogic.exchange.util.ExchangeUtils

def mailboxUtil      = ExchangeUtils.getMailboxUtil()
def strOldFolderName = g_request.get("qs_oldFolder")
def strNewFolderName = g_request.get("qs_editFolder")

mailboxUtil.updateFolderName("${strOldFolderName}", "${strNewFolderName}")