Quantcast
Channel: Exchange Server Development forum
Viewing all articles
Browse latest Browse all 7132

How to search emails from custom folder of mailbox users in Exchange Online Server using EWS SOAP operations

$
0
0

Hi Glen,

I have written python code to connect to exchange online server to find out emails from folders like (inbox, drafts and so on) of mailbox user. For searching emails in custom folder on users mailbox, my request SOAP xml does not work.

My request xml is as below

<?xml version="1.0" encoding="utf-8"?>

            <soap:Envelope

                xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"

                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

                xmlns:xsd="http://www.w3.org/2001/XMLSchema">

                <soap:Body>

                    <FindItem Traversal="Shallow" xmlns="http://schemas.microsoft.com/exchange/services/2006/messages">

                        <ItemShape>

                            <BaseShape xmlns="http://schemas.microsoft.com/exchange/services/2006/types">IdOnly</BaseShape>

                        </ItemShape>

                        <IndexedPageItemView MaxEntriesReturned="500" BasePoint="Beginning" Offset="0" />

                        <Restriction>

                                <And xmlns="http://schemas.microsoft.com/exchange/services/2006/types">

                                    <IsGreaterThanOrEqualTo xmlns="http://schemas.microsoft.com/exchange/services/2006/types">

                                    <FieldURI FieldURI="item:DateTimeCreated"  />

                                    <FieldURIOrConstant>

                                        <Constant Value="2013-10-20T00:00:00Z" />

                                    </FieldURIOrConstant>

                              </IsGreaterThanOrEqualTo>

                                    <IsLessThan xmlns="http://schemas.microsoft.com/exchange/services/2006/types">

                                    <FieldURI FieldURI="item:DateTimeCreated" />

                                    <FieldURIOrConstant>

                                        <Constant Value="2013-11-28T00:00:00Z" />

                                    </FieldURIOrConstant>

                              </IsLessThan>

                                 </And>

                          </Restriction>

                        <ParentFolderIds>

                            <DistinguishedFolderId Id="inbox" xmlns="http://schemas.microsoft.com/exchange/services/2006/types"/>

                        </ParentFolderIds>

                    </FindItem>

                </soap:Body>

            </soap:Envelope>

This xml works perfectly for standard mailbox folders like inbox, drafts. But for finding out emails from custom mailbox folders, we need to write <FolderId Id="" ChangeKey=""> under ParentFolderIds tag in above xml. I tried this, but it is not working.

Can you please help me out here? Or what should be the request XML to search emails from a custom mailbox folder? Please suggest

Thanks,

Manoj


Viewing all articles
Browse latest Browse all 7132

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>