Search code examples
c#exchange-serverexchangewebservicesexchange-server-2010exchange-server-2013

How can i get the sharedmailbox mails from EWS api?


I am able to get the sharedmailbox mail by this C# code but I want api for the same .Is EWS server provide so .

FolderId SharedMailbox = new FolderId(WellKnownFolderName.Inbox,"[email protected]");
ItemView itemView = new ItemView(1000);
service.FindItems(SharedMailbox,itemView);

I see there is something which give me my mailbox details

https://learn.microsoft.com/en-us/exchange/client-developer/web-service-reference/findconversation-operation

<?xml version="1.0" encoding="utf-8" ?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
               xmlns:xsd="http://www.w3.org/2001/XMLSchema"
               xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
               xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types"
               xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages">
  <soap:Header>
    <t:RequestServerVersion Version="Exchange2010_SP1" />
  </soap:Header>
  <soap:Body>
    <m:FindConversation>
      <m:IndexedPageItemView BasePoint="Beginning" MaxEntriesReturned="1" Offset="0"/>
      <m:ParentFolderId>
        <t:DistinguishedFolderId Id ="inbox"/>
      </m:ParentFolderId>
    </m:FindConversation>
  </soap:Body>
</soap:Envelope>

I want same like for my shared mailbox mails.

Is there is any api same like this for shared mailbox mail?


Solution

  • You can use this. You can mention shared mailbox like this.

    <?xml version="1.0" encoding="utf-8"?>
          <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                         xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages"
                         xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types"
                         xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
            <soap:Header>
              <t:RequestServerVersion Version="Exchange2013" />
            </soap:Header>
            <soap:Body>
              <m:FindConversation>
                <m:IndexedPageItemView MaxEntriesReturned="1" Offset="0" BasePoint="End" />
                <m:ParentFolderId>
                  <t:DistinguishedFolderId Id="inbox" >
                   <t:Mailbox>
                      <t:EmailAddress>[email protected]</t:EmailAddress>
                    </t:Mailbox>
                  </t:DistinguishedFolderId>
                </m:ParentFolderId>
              </m:FindConversation>
            </soap:Body>
          </soap:Envelope>