Solved

Use EWS or Microsoft Graph API to receive and extract attachment from emails from FME Server Fault tolerant deployment?


Badge +1

Hi, 

We have been trying to set up a process where our users can email their files to a shared mailbox and FME can extract the attachment &  process the attachment  from emails in our FME server fault tolerant deployment without success as neither STMP nor IMAP option is possible. 

Our IT  tech lead wanted to check if we can use EWS with FME server. 

I have read an old thread that this can be done through XML & httpCaller but I couldn’t find any further details of how to set this up. 

I also saw there is the Microsoft Graph API option and wonder if it’s recommended. 

Our IT Tech lead prefers EWS as we have another application that was already using EWS. 

Would be much appreciated if you could point me to the right direction.

Many thanks!

icon

Best answer by ninixink 28 April 2023, 00:35

View original

4 replies

Userlevel 1
Badge +6

Hi @ninixink​ ,

Is this the thread you are referring to?  

We don't have a specific example of using EWS and the HTTPCaller, but below are some resources that may help you get started. To fill out the HTTPCaller parameters, you'll need to refer to the EWS API documentation.

Microsoft Graph connector is a viable option. You can update the web connection with your own client id and secret.

 

Hope this helps!

-Kezia

Badge +1

Hi @ninixink​ ,

Is this the thread you are referring to?  

We don't have a specific example of using EWS and the HTTPCaller, but below are some resources that may help you get started. To fill out the HTTPCaller parameters, you'll need to refer to the EWS API documentation.

Microsoft Graph connector is a viable option. You can update the web connection with your own client id and secret.

 

Hope this helps!

-Kezia

Hi @keziaatsafe​ , thank you very much for your answer, really appreciate it.

We decided to use Microsoft Graph and we actually tried with MS Graph Type Application Web connection https://hub.safe.com/publishers/supporter/web-connections/microsoft-graph-type-application.

However, we are having a token expiration issue as it keeps expiring every hour and we have to keep reauthenticating it.

Have you seen this issue before and do you have any suggestion, please?

tokenExpiryTimeIn the Web Service Configuration, we kept the default setting and I notice the grant_type=client_credentials, is this correct?

MsGraphTypeApp 

Do we need to ask our Cloud team to grant us a refresh token & grant_type = refresh_token?

Also, do we need to ask them to add the fmeoauth URL to the Redirect URI in the MS Graph App like how we normally do with other Oauth2 App?

Thanks and looking forward to hearing from you!

 

 

Userlevel 1
Badge +6

Hi @keziaatsafe​ , thank you very much for your answer, really appreciate it.

We decided to use Microsoft Graph and we actually tried with MS Graph Type Application Web connection https://hub.safe.com/publishers/supporter/web-connections/microsoft-graph-type-application

However, we are having a token expiration issue as it keeps expiring every hour and we have to keep reauthenticating it. 

Have you seen this issue before and do you have any suggestion, please?

tokenExpiryTimeIn the Web Service Configuration, we kept the default setting and I notice the grant_type=client_credentials, is this correct? 

MsGraphTypeApp 

Do we need to ask our Cloud team to grant us a refresh token & grant_type = refresh_token?

Also, do we need to ask them to add the fmeoauth URL to the Redirect URI in the MS Graph App like how we normally do with other Oauth2 App? 

Thanks and looking forward to hearing from you!

 

 

Hi @ninixink​ ,

Thank you for the update! I think you're on the right track.

Did you follow this article, "How to create a web service for Microsoft Graph" when setting up the web connection? If not, please ensure you followed the steps in the article. In step 8, the refresh token parameters should look similar to this:  

client_id=[CLIENT_ID]&client_secret=[CLIENT_SECRET]&refresh_token=[REFRESH_TOKEN]&grant_type=refresh_token

Here's another resource on refresh token that may be helpful: https://community.safe.com/s/article/Web-Connections-and-FME

 

Please let me know if the resources I've shared are not what you're looking for!

Kezia

 

Badge +1

Hi @keziaatsafe​ , thank you very much for your answer, really appreciate it.

We decided to use Microsoft Graph and we actually tried with MS Graph Type Application Web connection https://hub.safe.com/publishers/supporter/web-connections/microsoft-graph-type-application.

However, we are having a token expiration issue as it keeps expiring every hour and we have to keep reauthenticating it.

Have you seen this issue before and do you have any suggestion, please?

tokenExpiryTimeIn the Web Service Configuration, we kept the default setting and I notice the grant_type=client_credentials, is this correct?

MsGraphTypeApp 

Do we need to ask our Cloud team to grant us a refresh token & grant_type = refresh_token?

Also, do we need to ask them to add the fmeoauth URL to the Redirect URI in the MS Graph App like how we normally do with other Oauth2 App?

Thanks and looking forward to hearing from you!

 

 

Thanks @keziaatsafe​  for the info, we finally resolved this issue with HTTPCaller and didn't use the Web Connection.

We reached out to MS support and there are 2 different Oauth2 flows - Oauth2 client credential flow (App Identity flow) or the Oauth2 code grant flow (User Identity flow). The one that we are using is App identity flow as this allows us to read multiple mailboxes including shared mailboxes. These mailboxes will need to be added to a security group that links with our App (Application ID/ Client ID).

So what we did was:

Hope that helps if anyone else has the same issue with MS Graph API reauthentication.

Thanks! 🙂

Reply