# Get data from a sub folder of a shared mailbox in Exchange

**URL:** <https://community.cdata.com/t/get-data-from-a-sub-folder-of-a-shared-mailbox-in-exchange/603>\
**Category:** CData Drivers\
**Tags:** question, odbc\
**Created:** [January 21, 2024, 9:00pm UTC](https://community.cdata.com/t/get-data-from-a-sub-folder-of-a-shared-mailbox-in-exchange/603 "2024-01-21T21:00:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![RichardGardner](https://avatars.discourse-cdn.com/v4/letter/r/ce7236/32.png) [@RichardGardner](https://community.cdata.com/u/RichardGardner)\
**Post date:** [January 21, 2024, 9:00pm UTC](https://community.cdata.com/t/get-data-from-a-sub-folder-of-a-shared-mailbox-in-exchange/603/1 "2024-01-21T21:00:39Z")

</div>

Im trying to design a select query to get the email items in a Inbox subfolder of a shared mailbox when using the Exchange ODBC driver (Exchange online/Office 365). I can get to the shared folder inbox but not query the subfolder. Can anyone help me figure it out please?

---

<div class="post-metadata">

**Author:** ![Ethem\_Q](https://sea3.discourse-cdn.com/cdata/user_avatar/community.cdata.com/ethem_q/32/1997_2.png) [@Ethem\_Q](https://community.cdata.com/u/Ethem_Q)\
**Post date:** [January 22, 2024, 8:05pm UTC](https://community.cdata.com/t/get-data-from-a-sub-folder-of-a-shared-mailbox-in-exchange/603/2 "2024-01-22T20:05:42Z")

</div>

Hi @RichardGardner

In order to get Items from a SubFolder via the&nbsp;Exchange ODBC driver you will need to specify the ParentFolderId as well as the SharedMailboxEmail pseudo column in your query. You might want to try a query as follows:

```auto
SELECT * FROM Inbox where ParentFolderId in (Select FolderId from Folders where ParentFolderName='Inbox') AND SharedMailBoxEmail='shared_email'

```

In case you want to get data for a particular SubFolder you can try the following:

```auto
SELECT * FROM Inbox where ParentFolderId in (Select FolderId from Folders where DisplayName='name') AND SharedMailBoxEmail='shared_email'

```

You can read more about this in the help documentation:

> **[CData ODBC Driver for Microsoft Exchange - Inbox](https://cdn.cdata.com/help/CEJ/odbc/pg_ewstable-inbox.htm#select-emails-from-inbox-subfolders)**
>
> CData ODBC Driver for Microsoft Exchange - RSBExchange - Inbox:

If you have any other questions or encounter any technical issues you can always reach out to our support team at [support@cdata.com](mailto:support@cdata.com) or submit a support ticket with us [here](https://www.cdata.com/support/submit.aspx).
