MSGraph Email Poller

Overview

Need to poll emails from your Exchange server? This smart service can be used in a poller process and extract the data from the Microsoft Exchange server. Messages are stored in the Appian Document System, as well as the attachments. Meta data is stored in a database table for further processing.

This plug-in provides an alternative to sending emails to an Appian process model when inbound email integration is requested. Instead of the email being forwarded to Appian, this plug-in reads the emails directly from the Exchange mailbox using the MS Graph API as described below:

  • Reads the mailbox using the MS Graph API
  • Convert the email to an EML file stored as an Appian document; Item attachments (calendar invites, messages) are kept in the eml file, File attachments removed from it and stored separately in the document management system.
  • Store all email file attachments as separate Appian documents
  • Store all email metadata (subject, author, recipients, etc...) into a set of tables in the database

Key Features & Functionality

All information how to deploy, configure and use the smart service is in the 'MS Graph Mail Poller.pdf' document in the downloaded zip. Extract the files in the ZIP and follow the instructions in the document.

Anonymous
Parents
  • Hello, 

    I get this error when trying to configure the mail poller

    Error code: ErrorAccessDeniedError message: Access is denied. Check credentials and try again.GET graph.microsoft.com/.../deleteditemsSdkVersion : graph-java/v5.51.0403 : Forbidden[...][Some information was truncated for brevity, enable debug logging for more details]

    {"error":{"code":"InvalidAuthenticationToken","message":"Access token is empty.","innerError":{"date":"2023-07-25T21:44:34","request-id":"d04f39a0-8818-4643-bc82-b5df05d45370","client-request-id":"d04f39a0-8818-4643-bc82-b5df05d45370"}}}

    Any idea what it could be ?

  • The error suggests that you have not properly set up the credentials in the Third Party Credentials. Please follow the documentation available in the download version of the plugin to validate you third party credentials are properly configured in the Appian Admin Console 

  • Make sure your application ID has full access to the inbox you try to connect to. Your Azure admin must set the permissions to Type: Application Permission: Mail.ReadWrite. The scope can then be reduced to the mailboxes you need to have access to from Appian. The error indicates that you are not allowed to access the deletedItem folder for the mailbox, which is the first check that is made within the plugin to validate access 

  • this is the config 

    and this is the error 

    2023-07-28 12:55:55 SEVERE [Appian Work Item - 18805 - WorkID 929 - execution01 - process 269002039 - model 32147 : UnattendedJavaActivityRequest] com.microsoft.graph.logger.DefaultLogger.logError CoreHttpProvider[sendRequestInternal] - 408Graph service exception
    2023-07-28 12:55:55 SEVERE [Appian Work Item - 18805 - WorkID 929 - execution01 - process 269002039 - model 32147 : UnattendedJavaActivityRequest] com.microsoft.graph.logger.DefaultLogger.logError Throwable detail: com.microsoft.graph.http.GraphServiceException: Error code: ErrorAccessDenied
    Error message: Access is denied. Check credentials and try again.
    
    GET graph.microsoft.com/.../deleteditems
    SdkVersion : graph-java/v5.51.0
    
    
    403 : Forbidden
    [...]
    
    [Some information was truncated for brevity, enable debug logging for more details]
    2023-07-28 12:55:55,292 [Appian Work Item - 18805 - WorkID 929 - execution01 - process 269002039 - model 32147 : UnattendedJavaActivityRequest] ERROR com.appiancs.msgraphmail.MSGraphMailPollerSmartService - Unexpected error polling for mail
    com.microsoft.graph.http.GraphServiceException: Error code: ErrorAccessDenied
    Error message: Access is denied. Check credentials and try again.
    
    GET graph.microsoft.com/.../deleteditems
    SdkVersion : graph-java/v5.51.0
    
    
    403 : Forbidden
    [...]
    
    [Some information was truncated for brevity, enable debug logging for more details]
    	at com.microsoft.graph.http.GraphServiceException.createFromResponse(GraphServiceException.java:419)
    	at com.microsoft.graph.http.GraphServiceException.createFromResponse(GraphServiceException.java:378)
    	at com.microsoft.graph.http.CoreHttpProvider.handleErrorResponse(CoreHttpProvider.java:512)
    	at com.microsoft.graph.http.CoreHttpProvider.processResponse(CoreHttpProvider.java:442)
    	at com.microsoft.graph.http.CoreHttpProvider.sendRequestInternal(CoreHttpProvider.java:408)
    	at com.microsoft.graph.http.CoreHttpProvider.send(CoreHttpProvider.java:225)
    	at com.microsoft.graph.http.CoreHttpProvider.send(CoreHttpProvider.java:202)
    	at com.microsoft.graph.http.BaseRequest.send(BaseRequest.java:335)
    	at com.microsoft.graph.requests.MailFolderRequest.get(MailFolderRequest.java:70)
    	at com.appiancs.msgraphmail.MSGraphMailPoller.getCustomFolderIds(MSGraphMailPoller.java:66)
    	at com.appiancs.msgraphmail.MSGraphMailPoller.pollForMail(MSGraphMailPoller.java:44)
    	at com.appiancs.msgraphmail.MSGraphMailPollerSmartService.run(MSGraphMailPollerSmartService.java:212)
    	at com.appiancorp.process.runtime.framework.DefaultActivityExecutor$1.lambda$call$0(DefaultActivityExecutor.java:136)
    	at com.appiancorp.plugins.PluginUsageLogger.runWithPluginInformation(PluginUsageLogger.java:54)
    	at com.appiancorp.process.runtime.framework.DefaultActivityExecutor$1.call(DefaultActivityExecutor.java:136)
    	at com.appiancorp.process.runtime.framework.DefaultActivityExecutor$1.call(DefaultActivityExecutor.java:130)
    	at com.appiancorp.common.ContextClassLoaderSwitcher.runInContext(ContextClassLoaderSwitcher.java:27)
    	at com.appiancorp.process.runtime.framework.DefaultActivityExecutor.execute(DefaultActivityExecutor.java:130)
    	at com.appiancorp.process.engine.UnattendedJavaActivityRequest.execute(UnattendedJavaActivityRequest.java:88)
    	at com.appiancorp.process.engine.UnattendedJavaActivityRequestResponseCreator.getJavaActivityResultResponse(UnattendedJavaActivityRequestResponseCreator.java:22)
    	at com.appiancorp.process.engine.UnattendedJavaActivityRequest.getJavaActivityResultResponse(UnattendedJavaActivityRequest.java:67)
    	at com.appiancorp.process.engine.UnattendedJavaActivityRequest.execute0(UnattendedJavaActivityRequest.java:55)
    	at com.appiancorp.common.persistence.data.AppianDataUserContextProvider.executeWithConsistentDataReads(AppianDataUserContextProvider.java:143)
    	at com.appiancorp.process.engine.ProcessContinuationRequest.executeOuter(ProcessContinuationRequest.java:68)
    	at com.appiancorp.process.engine.ContinuationRequest.execute(ContinuationRequest.java:129)
    	at com.appiancorp.process.workpoller.UnattendedRequestHandlerBean.onMessage(UnattendedRequestHandlerBean.java:36)
    	at com.appiancorp.process.workpoller.WorkItem.run(WorkItem.java:110)
    	at org.springframework.jca.work.SimpleTaskWorkManager$DelegatingWorkAdapter.run(SimpleTaskWorkManager.java:241)
    	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    	at java.lang.Thread.run(Thread.java:750)
Comment
  • this is the config 

    and this is the error 

    2023-07-28 12:55:55 SEVERE [Appian Work Item - 18805 - WorkID 929 - execution01 - process 269002039 - model 32147 : UnattendedJavaActivityRequest] com.microsoft.graph.logger.DefaultLogger.logError CoreHttpProvider[sendRequestInternal] - 408Graph service exception
    2023-07-28 12:55:55 SEVERE [Appian Work Item - 18805 - WorkID 929 - execution01 - process 269002039 - model 32147 : UnattendedJavaActivityRequest] com.microsoft.graph.logger.DefaultLogger.logError Throwable detail: com.microsoft.graph.http.GraphServiceException: Error code: ErrorAccessDenied
    Error message: Access is denied. Check credentials and try again.
    
    GET graph.microsoft.com/.../deleteditems
    SdkVersion : graph-java/v5.51.0
    
    
    403 : Forbidden
    [...]
    
    [Some information was truncated for brevity, enable debug logging for more details]
    2023-07-28 12:55:55,292 [Appian Work Item - 18805 - WorkID 929 - execution01 - process 269002039 - model 32147 : UnattendedJavaActivityRequest] ERROR com.appiancs.msgraphmail.MSGraphMailPollerSmartService - Unexpected error polling for mail
    com.microsoft.graph.http.GraphServiceException: Error code: ErrorAccessDenied
    Error message: Access is denied. Check credentials and try again.
    
    GET graph.microsoft.com/.../deleteditems
    SdkVersion : graph-java/v5.51.0
    
    
    403 : Forbidden
    [...]
    
    [Some information was truncated for brevity, enable debug logging for more details]
    	at com.microsoft.graph.http.GraphServiceException.createFromResponse(GraphServiceException.java:419)
    	at com.microsoft.graph.http.GraphServiceException.createFromResponse(GraphServiceException.java:378)
    	at com.microsoft.graph.http.CoreHttpProvider.handleErrorResponse(CoreHttpProvider.java:512)
    	at com.microsoft.graph.http.CoreHttpProvider.processResponse(CoreHttpProvider.java:442)
    	at com.microsoft.graph.http.CoreHttpProvider.sendRequestInternal(CoreHttpProvider.java:408)
    	at com.microsoft.graph.http.CoreHttpProvider.send(CoreHttpProvider.java:225)
    	at com.microsoft.graph.http.CoreHttpProvider.send(CoreHttpProvider.java:202)
    	at com.microsoft.graph.http.BaseRequest.send(BaseRequest.java:335)
    	at com.microsoft.graph.requests.MailFolderRequest.get(MailFolderRequest.java:70)
    	at com.appiancs.msgraphmail.MSGraphMailPoller.getCustomFolderIds(MSGraphMailPoller.java:66)
    	at com.appiancs.msgraphmail.MSGraphMailPoller.pollForMail(MSGraphMailPoller.java:44)
    	at com.appiancs.msgraphmail.MSGraphMailPollerSmartService.run(MSGraphMailPollerSmartService.java:212)
    	at com.appiancorp.process.runtime.framework.DefaultActivityExecutor$1.lambda$call$0(DefaultActivityExecutor.java:136)
    	at com.appiancorp.plugins.PluginUsageLogger.runWithPluginInformation(PluginUsageLogger.java:54)
    	at com.appiancorp.process.runtime.framework.DefaultActivityExecutor$1.call(DefaultActivityExecutor.java:136)
    	at com.appiancorp.process.runtime.framework.DefaultActivityExecutor$1.call(DefaultActivityExecutor.java:130)
    	at com.appiancorp.common.ContextClassLoaderSwitcher.runInContext(ContextClassLoaderSwitcher.java:27)
    	at com.appiancorp.process.runtime.framework.DefaultActivityExecutor.execute(DefaultActivityExecutor.java:130)
    	at com.appiancorp.process.engine.UnattendedJavaActivityRequest.execute(UnattendedJavaActivityRequest.java:88)
    	at com.appiancorp.process.engine.UnattendedJavaActivityRequestResponseCreator.getJavaActivityResultResponse(UnattendedJavaActivityRequestResponseCreator.java:22)
    	at com.appiancorp.process.engine.UnattendedJavaActivityRequest.getJavaActivityResultResponse(UnattendedJavaActivityRequest.java:67)
    	at com.appiancorp.process.engine.UnattendedJavaActivityRequest.execute0(UnattendedJavaActivityRequest.java:55)
    	at com.appiancorp.common.persistence.data.AppianDataUserContextProvider.executeWithConsistentDataReads(AppianDataUserContextProvider.java:143)
    	at com.appiancorp.process.engine.ProcessContinuationRequest.executeOuter(ProcessContinuationRequest.java:68)
    	at com.appiancorp.process.engine.ContinuationRequest.execute(ContinuationRequest.java:129)
    	at com.appiancorp.process.workpoller.UnattendedRequestHandlerBean.onMessage(UnattendedRequestHandlerBean.java:36)
    	at com.appiancorp.process.workpoller.WorkItem.run(WorkItem.java:110)
    	at org.springframework.jca.work.SimpleTaskWorkManager$DelegatingWorkAdapter.run(SimpleTaskWorkManager.java:241)
    	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    	at java.lang.Thread.run(Thread.java:750)
Children
  • Make sure your application ID has full access to the inbox you try to connect to. Your Azure admin must set the permissions to Type: Application Permission: Mail.ReadWrite. The scope can then be reduced to the mailboxes you need to have access to from Appian. The error indicates that you are not allowed to access the deletedItem folder for the mailbox, which is the first check that is made within the plugin to validate access