Enter your keyword

post

Fitter email Message of a Folder using Microsoft Email adapter in Integration Cloud Service

 

This blog is the extension of the blog in which we have showcased how to read messages of a specific folder of the Microsoft account using MS email adapter in Oracle ICS. 

ICS doesn’t allow to put any request parameter while configuring the MS email adapter in the request. However, If we see the Microsoft REST Service documentation, this allows to put request parameters (search, filter, select, order by, top etc..) in the REST APIs.

Let’s do some tweak in the Integration and put the request parameter (filter) by editing the  WSDL & JCA files but exporting the Integration

Export the Integration that we created in the previous blog.

Unjar the file using some utility like 7-zip. Once unzipped the Integration, edit two files:

  • ReadEmails_REQUEST.WSDL
  • ReadEmails_REQUEST.jca
 
Path of the files  would be READ_EMAILS_01.00.0000icspackageprojectREAD_EMAILS_01.00.0000resourcesapplication_15inbound_16resourcegroup_17
 
Edit the ReadEmails_REQUEST.WSDL first. Notice the below-highlighted parameter.  
 

 

<xs:complexType name=”Get-Folder-Messages_GETType”>
            <xs:sequence>
               <xs:element maxOccurs=”1″ minOccurs=”0″ type=”TemplateParameters” name=”TemplateParameters” />
            </xs:sequence>
         </xs:complexType>
         <xs:complexType name=”TemplateParameters“>
            <xs:annotation>
               <xs:appinfo />
            </xs:annotation>
            <xs:sequence>
               <xs:element name=”folder_id” type=”xs:string” minOccurs=”1″ maxOccurs=”1″ />
            </xs:sequence>
         </xs:complexType>

While configuring the MS email adapter, Only Template parameter with the name folder_id got added in the WSDL file. Let’s add QueryParameters also in the WSDL file. Replace the above section with below:

<xs:complexType name=”Get-Folder-Messages_GETType”>
 
            <xs:sequence>
 
               <xs:element maxOccurs=”1″ minOccurs=”0″ type=”TemplateParameters” name=”TemplateParameters” />
 
              <xs:element maxOccurs=”1″ minOccurs=”0″ type=”QueryParameters” name=”QueryParameters” />
 
            </xs:sequence>
 
         </xs:complexType>
 
         <xs:complexType name=”TemplateParameters”>
 
            <xs:annotation>
 
               <xs:appinfo />
 
            </xs:annotation>
 
            <xs:sequence>
 
               <xs:element name=”folder_id” type=”xs:string” minOccurs=”1″ maxOccurs=”1″ />
 
            </xs:sequence>
 
         </xs:complexType>
 
          <xs:complexType name=”QueryParameters”>
 
            <xs:annotation>
 
               <xs:appinfo />
 
            </xs:annotation>
 
            <xs:sequence>
 
               <xs:element name=”_0x646c72_filter” type=”xs:string” minOccurs=”1″ maxOccurs=”1″ />
 
            </xs:sequence>
            </xs:complexType>
 

Edit the ReadEmails_REQUEST.jca file and add highlighted property in endpoint-interaction node.

<endpoint-interaction portType=”ReadEmails_REQUESTPortType” operation=”Get-Folder-Messages_GET”>
 
    <interaction-spec className=”oracle.tip.adapter.cloud.CloudInteractionSpec”>
 
      <property name=”targetOperation” value=”Get-Folder-Messages_GET”/>
 
      <property name=”operationPath” value=”https://outlook.office.com/api/v2.0/me/MailFolders/{folder_id}/messages”/>
 
      <property name=”integrationSchemaNamespace” value=”http://xmlns.oracle.com/cloud/adapter/microsoftemail/ReadEmails/types”/>
 
      <property name=”ResponseElementNS” value=”http://xmlns.oracle.com/cloud/adapter/microsoftemail/ReadEmails/types”/>
 
      <property name=”ResourceURI” value=”https://outlook.office.com/api/v2.0/me/MailFolders/{folder_id}/messages”/>
 
      <property name=”QueryParameters” value=”_0x646c72_filter”/>
 
      <property name=”generatePartnerLink” value=”false”/>
 
      <property name=”HttpVerb” value=”GET”/>
 
      <property name=”operation” value=”Get-Folder-Messages_GET”/>
 
      <property name=”ResponseElementName” value=”messageResource.definitions.messages.Get-Folder-Messages_GET._ResponseDataType”/>
 
      <property name=”integrationWSDLNamespace” value=”http://xmlns.oracle.com/cloud/adapter/microsoftemail/ReadEmails”/>
 
    </interaction-spec>
    
</endpoint-interaction>
 


Note: We added _0x646c72_ as a prefix in filter property. The actual parameter name is $filter if you see the MS REST API documentation. Since ICS converts the $ sign with _0x646c72_  when we add request parameter in an adapter as a request parameter. That’s the reason we already replaced $ sign with _0x646c72_

Save both the files. Open the .iar directly file using 7-zip and replace the updated content in both (WSLD & JCA ) files.

Import the updated integration using Import button. After successful import, Open the ReadEmalis mapper and notice one QueryParamter with name _0x646c72_filter got added

In the query parameter _0x646c72_filter we will assign IsRead eq false. This value will fetch all the email which are unread.


Activate the integration and submit it once. See if we have any unread email in the Inbox

Since there is no unread email in the Inbox as yet, that’s the reason there is the blank response.

Let’s send one email to the account and run the integration again

Notice one unread email fetched as per the filter added.

This is how more filter can be added directly by editing the WSDL & JCA files

Leave a Reply

Your email address will not be published.