This site contains the documentation that is relevant to older WSO2 product versions and offerings.
For the latest WSO2 documentation, visit https://wso2.com/documentation/.

Working with Folders in Outlook Mail

Overview

The following operations allow you to work with folders. Click an operation name to see details on how to use it.

For a sample proxy service that illustrates how to work with messages, see Sample configuration.

OperationDescription

createFolder

Create a new folder

deleteFolder

Delete a folder

getChildFolder

Get child folder

getFolder

Get the folder collection 

moveFolder

Move a folder and its contents

Operation details

This section provides further details on the operations related to discussions.

Create Folder

 The createFolder operation creates a child folder by the name.

createFolder
<outlookmail.createFolder>
    <folderId>{$ctx:folderId}</folderId>
    <displayName>{$ctx:displayName}</displayName>
</outlookmail.createFolder>
Properties

folderId: Required -The folder ID, or the InboxDraftsSentItems, orDeletedItems well-known folder name.

displayName: Required -The display name of the folder.

Sample request

Following is a sample REST/JSON request that can be handled by the createFolder operation.

Sample request for createFolder
{
   "apiUrl":"https://outlook.office.com/api",
   "apiVersion":"v2.0",
   "accessToken":"accesstoken",
   "refreshToken":"refreshtoken",
   "clientSecret":"K+M5n5OidY4hJ",
   "clientId":"dec93ce7-dd0f",
   "resource":"https://outlook.office.com/",
   "redirectUri":"http://www.wso2.com",
   "registryPath":"Connector/OutlookMailRegPath",
   "intervalTime":"",
   "folderId":"Inbox",
   "displayName":"Inbox_Child"
}

 

Delete Folder

The deleteFolder operation deletes a folder and all of its contents.

deleteFolder
<outlookmail.deleteFolder>
    <folderId>{$ctx:folderId}</folderId>
</outlookmail.deleteFolder>
Properties

folderId: Required -The folder ID, or the InboxDraftsSentItems, orDeletedItems well-known folder name.

Sample request

Following is a sample REST/JSON request that can be handled by the deleteFolder operation.

Sample request for deleteFolder
{
   "apiUrl":"https://outlook.office.com/api",
   "apiVersion":"v2.0",
   "accessToken":"accesstoken",
   "refreshToken":"refreshtoken",
   "clientSecret":"K+M5n5OidY4hJ",
   "clientId":"dec93ce7-dd0f",
   "resource":"https://outlook.office.com/",
   "redirectUri":"http://www.wso2.com",
   "registryPath":"Connector/OutlookMailRegPath",
   "intervalTime":"",
   "folderId":"Inbox"
}

 

Get Child Folder

 The getChildFolder operation gets the folder collection under the specified folder.

getChildFolder
<outlookmail.deleteFolder>
    <folderId>{$ctx:folderId}</folderId>
</outlookmail.deleteFolder>
Properties

folderId: Required -The folder ID, or the InboxDraftsSentItems, orDeletedItems well-known folder name.

Sample request

Following is a sample REST/JSON request that can be handled by the getChildFolder operation.

Sample request for getChildFolder
{
   "apiUrl":"https://outlook.office.com/api",
   "apiVersion":"v2.0",
   "accessToken":"accesstoken",
   "refreshToken":"refreshtoken",
   "clientSecret":"K+M5n5OidY4hJ",
   "clientId":"dec93ce7-dd0f",
   "resource":"https://outlook.office.com/",
   "redirectUri":"http://www.wso2.com",
   "registryPath":"Connector/OutlookMailRegPath",
   "intervalTime":"",
   "folderId":"Inbox"
}

 

Get Folder

 The getFolder operation gets the folder collection under the root folder of the signed-in user. 

getFolder
<outlookmail.getFolder/>

Sample request

Following is a sample REST/JSON request that can be handled by the getFolder operation.

Sample Request for getFolder
{
   "apiUrl":"https://outlook.office.com/api",
   "apiVersion":"v2.0",
   "accessToken":"accesstoken",
   "refreshToken":"refreshtoken",
   "clientSecret":"K+M5n5OidY4hJ",
   "clientId":"dec93ce7-dd0f",
   "resource":"https://outlook.office.com/",
   "redirectUri":"http://www.wso2.com",
   "registryPath":"Connector/OutlookMailRegPath",
   "intervalTime":""
}

Move Folder

 The moveFolder operation moves a folder and its contents to another folder.

moveFolder
<outlookmail.moveFolder>
    <folderId>{$ctx:folderId}</folderId>
    <destinationId>{$ctx:destinationId}</destinationId>
</outlookmail.moveFolder>
Properties

folderId: Required -The folder ID, or the InboxDraftsSentItems, orDeletedItems well-known folder name.

destinationId: Required -The destination folder ID, or the InboxDrafts,SentItems, or DeletedItems well-known folder name.

Sample request

Following is a sample REST/JSON request that can be handled by the moveFolder operation.

Sample request for moveFolder
{
   "apiUrl":"https://outlook.office.com/api",
   "apiVersion":"v2.0",
   "accessToken":"accesstoken",
   "refreshToken":"refreshtoken",
   "clientSecret":"K+M5n5OidY4hJ",
   "clientId":"dec93ce7-dd0f",
   "resource":"https://outlook.office.com/",
   "redirectUri":"http://www.wso2.com",
   "registryPath":"Connector/OutlookMailRegPath",
   "intervalTime":"",
   "folderId":"TESTFOLDER",
   "destinationId":"DeletedItems"
}

 

Sample configuration

 Following is a sample proxy service that illustrates how to connect to Outlookmail with the init operation and use the createFolder operation. The sample request for this proxy can be found in createFolder sample request.

Sample proxy
<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
       name="outLook_CreateFolder"
       transports="https http"
       startOnLoad="true"
       trace="disable">
   <description/>
   <target>
      <inSequence>
         <property name="apiUrl" expression="json-eval($.apiUrl)"/>
         <property name="accessToken" expression="json-eval($.accessToken)"/>
         <property name="folderId" expression="json-eval($.folderId)"/>
         <property name="displayName" expression="json-eval($.displayName)"/>
         <property name="apiVersion" expression="json-eval($.apiVersion)"/>
         <property name="refreshToken" expression="json-eval($.refreshToken)"/>
         <property name="clientSecret" expression="json-eval($.clientSecret)"/>
         <property name="clientId" expression="json-eval($.clientId)"/>
         <property name="resource" expression="json-eval($.resource)"/>
         <property name="redirectUri" expression="json-eval($.redirectUri)"/>
         <property name="registryPath" expression="json-eval($.registryPath)"/>
         <property name="intervalTime" expression="json-eval($.intervalTime)"/>
         <outlookmail.init>
            <apiUrl>{$ctx:apiUrl}</apiUrl>
            <accessToken>{$ctx:accessToken}</accessToken>
            <apiVersion>{$ctx:apiVersion}</apiVersion>
            <refreshToken>{$ctx:refreshToken}</refreshToken>
            <clientSecret>{$ctx:clientSecret}</clientSecret>
            <clientId>{$ctx:clientId}</clientId>
            <resource>{$ctx:resource}</resource>
            <redirectUri>{$ctx:redirectUri}</redirectUri>
            <registryPath>{$ctx:registryPath}</registryPath>
            <intervalTime>{$ctx:intervalTime}</intervalTime>
         </outlookmail.init>
         <outlookmail.createFolder>
            <folderId>{$ctx:folderId}</folderId>
            <displayName>{$ctx:displayName}</displayName>
         </outlookmail.createFolder>
         <respond/>
      </inSequence>
   </target>
</proxy>