搜索在已发送邮件中查找邮件,但不在收件箱中查找 [英] Search finds messages in sentitems but not in inbox

查看:141
本文介绍了搜索在已发送邮件中查找邮件,但不在收件箱中查找的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

在使用EWS搜索邮件时,我遇到了一个相当奇怪的问题。我的经验是,搜索将在sentitems文件夹中找到结果,但不会在收件箱中找到结果,我无法弄清楚导致此行为的原因,所以现在我转向所有专家。

下面是一个示例请求/响应,它返回来自sentitems的两个结果,但没有来自收件箱或草稿。但是在收件箱中有一封我希望也会收到的电子邮件。当使用GetItem读出该特定电子邮件时,我可以看到SENDER和FROM属性确实包含了我期望的内容,即发件人的电子邮件地址(我将假设搜索与查询匹配)。可以在本文末尾看到未找到的电子邮件。

我的请求中是否有人发现错误?或指导我为什么我看到这种行为以及如何让它工作?

最好的问候和TIA
Mads

请求
<?xml version =' 1.0'coding ='UTF-8'?>
< soapenv:Envelope
xmlns:soapenv =" http://schemas.xmlsoap.org/soap/envelope/">
< soapenv:Header>
< RequestServerVersion
xmlns =" http://schemas.microsoft.com/exchange/services/2006/types"
Version =" Exchange2007_SP1" />
< / soapenv:标题>
< soapenv:正文>
< FindItem
xmlns =" http://schemas.microsoft.com/exchange/services/2006 / messages"
Traversal =" Shallow">
< ItemShape>
< BaseShape
xmlns =" http://schemas.microsoft.com/exchange/services/2006/类型">
IdOnly
< / BaseShape>
< AdditionalProperties
xmlns =" http://schemas.microsoft.com/exchange/services/2006/types"> < br>< FieldURI FieldURI =" item:ItemClass" />
< / AdditionalProperties>
< / ItemShape>
<限制>
<或
xmlns =" http://schemas.microsoft.com/exchange / services / 2006 / types">
< Contains
ContainmentComparison =" IgnoreCaseAndNonSpacingCharacters"
ContainmentMode =" Substring">
< FieldURI FieldURI =" message:from" />
<常数值=" en_FTU1" />
< / Contains>
< Contains
ContainmentComparison =" IgnoreCaseAndNonSpacingCharacters"
ContainmentMode =" Substring">
< FieldURI FieldURI =" message:ToRecipients" ; />
<常数值=" en_FTU1" />
< / Contains>
< Contains
ContainmentComparison =" IgnoreCaseAndNonSpacingCharacters"
ContainmentMode =" Substring">
< FieldURI FieldURI =" message:CcRecipients" ; />
<常数值=" en_FTU1" />
< / Contains>
< Contains
ContainmentComparison =" IgnoreCaseAndNonSpacingCharacters"
ContainmentMode =" Substring">
< FieldURI FieldURI =" message:BccRecipients" ; />
<常数值=" en_FTU1" />
< / Contains>
< Contains
ContainmentComparison =" IgnoreCaseAndNonSpacingCharacters"
ContainmentMode =" Substring">
< FieldURI FieldURI =" message:Sender" ; />
<常数值=" en_FTU1" />
< / Contains>
< / Or>
< / Restriction>
< ParentFolderIds>
< DistinguishedFolderId
xmlns =" http:/ /schemas.microsoft.com/exchange/services/2006/types"
Id =" inbox">
< Mailbox>
< EmailAddress>
palle.hansen@ex2007.test .local
< / EmailAddress>
< / Mailbox>
< / DistinguishedFolderId>
< DistinguishedFolderId
xmlns =" http://schemas.microsoft.com/exchange / services / 2006 / types"
Id =" drafts">
< Mailbox>
< EmailAddress>
palle.hansen@ex2007.test.local
< / EmailAddress>
< / Mailbox>
< / DistinguishedFolderId>
< DistinguishedFolderId
xmlns =" http://schemas.microsoft.com/exchange/services/2006/types"
Id =" sentitems">
< Mailbox>
< EmailAddress>
palle.hansen@ex2007.test.local
< / EmailAddress>
< / Mailbox& gt;
< / DistinguishedFolderId>
< / ParentFolderIds>
< / FindItem>
< / soapenv:Body>
< / soapenv:Envelope>
< br> RESPONSE
<?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:Header>
< t:ServerVersionInfo MajorVersion =" 8" MinorVersion =" 0"
MajorBuildNumber =" 783" MinorBuildNumber =" 2"
xmlns:t =" http://schemas.microsoft.com/exchange/services/2006/types" />
< / soap:Header>
< soap:Body>
< m:FindItemResponse
xmlns:t =" http://schemas.microsoft.com/exchange / services / 2006 / types"
xmlns:m =" http://schemas.microsoft.com/exchange/services/2006/messages">
< m:ResponseMessages>
< m:FindItemResponseMessage ResponseClass =" Success">
< m:ResponseCode> NoError< / m:ResponseCode>
< m:RootFolder TotalItemsInView =" 0"
IncludesLastItemInRange =" true" >
< t:Items />
< / m:RootFolder>
< / m:FindItemResponseMessage>
< m:FindItemResponseMessage ResponseClass =&qu ot;成功">
< m:ResponseCode> NoError< / m:ResponseCode>
< m:RootFolder TotalItemsInView =" 0"
IncludesLastItemInRange =" true">
< t:Items />
< / m:RootFolder>
< / m:FindItemResponseMessage>
< m:FindItemResponseMessage ResponseClass =" Success">
< m :ResponseCode> NoError< / m:ResponseCode>
< m:RootFolder TotalItemsInView =" 2"
IncludesLastItemInRange =" true">
< t:Items>
< t :消息>
< T:ITEMID结果,编号= QUOT; AAAeAHBhbGxlLmhhbnNlbkBleDIwMDcudGVzdC5sb2NhbABGAAAAAAACtF39H9RiQ6dHcq + 5l29xBwCHS94bRKbyRKd5UqImf2JbAXRGOxKBAACHS94bRKbyRKd5UqImf2JbAdTLQhUBAAA = QUOT;结果,ChangeKey = QUOT; CQAAABYAAACHS94bRKbyRKd5UqImf2JbAdTLQj1l" />
< t:ItemClass> IPM.Note< / t:ItemClass>
< / t:消息>
< t:消息>
< t:ItemId
J =" AAAeAHBhbGxlLmhhbnNlbkBleDIwMDcudGVzdC5sb2NhbABGAAAAAAACtF39H9RiQ6dHcq + 5l29xBwCHS94bRKbyRKd5UqImf2JbAXRGOxKBAACHS94bRKbyRKd5UqImf2JbAdTLQhT / AAA = QUOT;结果,ChangeKey = QUOT; CQAAABYAAACHS94bRKbyRKd5UqImf2JbAdTLQjlA" />
< t:ItemClass> IPM.Note< / t:ItemClass>
< / t:消息>
< / t:Items>
< / m:RootFolder> ;
< / m:FindItemResponseMessage>
< / m:ResponseMessages>
< / m:FindItemResponse>
< / soap:Body>
< / soap:Envelope> ;


未发现的电子邮件
?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:Header>
< t:ServerVersionInfo MajorVersion =" 8" MinorVersion =" 0"
MajorBuildNumber =" 783" MinorBuildNumber =" 2"
xmlns:t =" http://schemas.microsoft.com/exchange/services/2006/types" />
< / soap:Header>
< soap:Body>
< m:GetItemResponse
xmlns:t =" http://schemas.microsoft.com/exchange / services / 2006 / types"
xmlns:m =" http://schemas.microsoft.com/exchange/services/2006/messages">
< m:ResponseMessages>
< m:GetItemResponseMessage ResponseClass =" Success">
< m:ResponseCode> NoError< / m:ResponseCode>
< m:Items>
< t:Message>
< t:ItemId
Id =" AAAeAHBhbGxlLmhhbnNlbkBleDIwMDcudGVzdC5sb2NhbABGAAAAAAACtF39H9RiQ6dHcq + 5l29xBwCHS94bRKbyRKd5UqImf2JbAXRGOxJ / AACHS94bRKbyRKd5UqImf2JbAdTLQfzeAAA ="
ChangeKey = QUOT; CQAAABYAAACHS94bRKbyRKd5UqImf2JbAdTLQjk5" />
< t:ParentFolderId
Id =" AAAeAHBhbGxlLmhhbnNlbkBleDIwMDcudGVzdC5sb2NhbAAAAAAAAAACtF39H9RiQ6dHcq + 5l29xAQCHS94bRKbyRKd5UqImf2JbAXRGOxJ / AAA ="
ChangeKey =" AQAAAA ==" />
< t:主题>测试电子邮件< / t:主题>
< t:Body BodyType ="文字"> cvnbxcnxcn< / t:正文>
< t: DateTimeReceived>
2009-03-09T08:31:21Z
< / t:DateTimeReceived>
< t:重要性>正常< / t:重要性>
< t:IsDraft> false< ; / t:IsDraft>
< t:DateTimeSent>
2009-03-09T08:30:53Z
< / t:DateTimeSent>
< t:DateTimeCreated>
2009-03-09T08:31:21Z
< / t:DateTimeCreated>
< t:HasAttachments> false< / t:HasAttachments>
< t:Sender>
< t :邮箱>
< t:名称> en_FTU1< / t:名称>
< t:EmailAddress>
en_FTU1@ex2007.test.local
< / t:EmailAddress>
< t:RoutingType> SMTP< / t:RoutingType>
< / t:Mailbox>
< / t:发件人>
< t:ToRecipients>
< t:邮箱>
< t:名称> Palle Hansen< / t:名称>
< t:EmailAddress> ;
palle.hansen@ex2007.test.local
< / t:EmailAddress>
< t:RoutingType> SMTP< / t:RoutingType>
< / t:Mailbox> < br>< / t:ToRecipients>
< t:From>
< t:Mailbox>
< t:名称> en_FTU1< / t:名称>
< t:EmailAddress>
en_FTU1@ex2007.test.local
< / t:EmailAddress>
< t:RoutingType> ; SMTP< / t:RoutingType>
< / t:邮箱>
< / t:来自>
< t:IsRead> true< / t:IsRead>
< / t:消息>
< / m:项目>
< / m:GetItemResponseMessage>
< / m:ResponseMessages>
< / m:GetItemResponse>
< /小号oap:Body>
< / soap:Envelope>

解决方案

截至今天,问题似乎已经消失。我不知道Exchange系统是否以任何方式被修改过,但我的代码却没有。奇怪...

Hi all,

I'm having a rather strange problem when performing a search for messages using EWS. The experience I have is that the search will find results in the sentitems folder, but not in the Inbox, and I can't figure out what causes this behavior, so now I'm turning to all you experts.

Below is a sample request/response which returns two results from the sentitems but nothing from Inbox or drafts. However in the inbox there is an email which I would expect to also be returned. When reading out that particular email using a GetItem I can see that the SENDER and FROM attributes does include what I would expect, namely the email address of the sender (which I would then assume the search to match to the query). The email that is not found can be seen at the end of this post.

Can anyone spot an error in my request? or guide me as to why I see this behavior and how I can get it to work?

Best regards and TIA
Mads

REQUEST
<?xml version='1.0' encoding='UTF-8'?>
<soapenv:Envelope
    xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
    <soapenv:Header>
        <RequestServerVersion
            xmlns="http://schemas.microsoft.com/exchange/services/2006/types"
            Version="Exchange2007_SP1" />
    </soapenv:Header>
    <soapenv:Body>
        <FindItem
            xmlns="http://schemas.microsoft.com/exchange/services/2006/messages"
            Traversal="Shallow">
            <ItemShape>
                <BaseShape
                    xmlns="http://schemas.microsoft.com/exchange/services/2006/types">
                    IdOnly
                </BaseShape>
                <AdditionalProperties
                    xmlns="http://schemas.microsoft.com/exchange/services/2006/types">
                    <FieldURI FieldURI="item:ItemClass" />
                </AdditionalProperties>
            </ItemShape>
            <Restriction>
                <Or
                    xmlns="http://schemas.microsoft.com/exchange/services/2006/types">
                    <Contains
                        ContainmentComparison="IgnoreCaseAndNonSpacingCharacters"
                        ContainmentMode="Substring">
                        <FieldURI FieldURI="message:From" />
                        <Constant Value="en_FTU1" />
                    </Contains>
                    <Contains
                        ContainmentComparison="IgnoreCaseAndNonSpacingCharacters"
                        ContainmentMode="Substring">
                        <FieldURI FieldURI="message:ToRecipients" />
                        <Constant Value="en_FTU1" />
                    </Contains>
                    <Contains
                        ContainmentComparison="IgnoreCaseAndNonSpacingCharacters"
                        ContainmentMode="Substring">
                        <FieldURI FieldURI="message:CcRecipients" />
                        <Constant Value="en_FTU1" />
                    </Contains>
                    <Contains
                        ContainmentComparison="IgnoreCaseAndNonSpacingCharacters"
                        ContainmentMode="Substring">
                        <FieldURI FieldURI="message:BccRecipients" />
                        <Constant Value="en_FTU1" />
                    </Contains>
                    <Contains
                        ContainmentComparison="IgnoreCaseAndNonSpacingCharacters"
                        ContainmentMode="Substring">
                        <FieldURI FieldURI="message:Sender" />
                        <Constant Value="en_FTU1" />
                    </Contains>
                </Or>
            </Restriction>
            <ParentFolderIds>
                <DistinguishedFolderId
                    xmlns="http://schemas.microsoft.com/exchange/services/2006/types"
                    Id="inbox">
                    <Mailbox>
                        <EmailAddress>
                            palle.hansen@ex2007.test.local
                        </EmailAddress>
                    </Mailbox>
                </DistinguishedFolderId>
                <DistinguishedFolderId
                    xmlns="http://schemas.microsoft.com/exchange/services/2006/types"
                    Id="drafts">
                    <Mailbox>
                        <EmailAddress>
                            palle.hansen@ex2007.test.local
                        </EmailAddress>
                    </Mailbox>
                </DistinguishedFolderId>
                <DistinguishedFolderId
                    xmlns="http://schemas.microsoft.com/exchange/services/2006/types"
                    Id="sentitems">
                    <Mailbox>
                        <EmailAddress>
                            palle.hansen@ex2007.test.local
                        </EmailAddress>
                    </Mailbox>
                </DistinguishedFolderId>
            </ParentFolderIds>
        </FindItem>
    </soapenv:Body>
</soapenv:Envelope>

RESPONSE
<?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:Header>
        <t:ServerVersionInfo MajorVersion="8" MinorVersion="0"
            MajorBuildNumber="783" MinorBuildNumber="2"
            xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types" />
    </soap:Header>
    <soap:Body>
        <m:FindItemResponse
            xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types"
            xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages">
            <m:ResponseMessages>
                <m:FindItemResponseMessage ResponseClass="Success">
                    <m:ResponseCode>NoError</m:ResponseCode>
                    <m:RootFolder TotalItemsInView="0"
                        IncludesLastItemInRange="true">
                        <t:Items />
                    </m:RootFolder>
                </m:FindItemResponseMessage>
                <m:FindItemResponseMessage ResponseClass="Success">
                    <m:ResponseCode>NoError</m:ResponseCode>
                    <m:RootFolder TotalItemsInView="0"
                        IncludesLastItemInRange="true">
                        <t:Items />
                    </m:RootFolder>
                </m:FindItemResponseMessage>
                <m:FindItemResponseMessage ResponseClass="Success">
                    <m:ResponseCode>NoError</m:ResponseCode>
                    <m:RootFolder TotalItemsInView="2"
                        IncludesLastItemInRange="true">
                        <t:Items>
                            <t:Message>
                                <t:ItemId
                                    Id="AAAeAHBhbGxlLmhhbnNlbkBleDIwMDcudGVzdC5sb2NhbABGAAAAAAACtF39H9RiQ6dHcq+5l29xBwCHS94bRKbyRKd5UqImf2JbAXRGOxKBAACHS94bRKbyRKd5UqImf2JbAdTLQhUBAAA="
                                    ChangeKey="CQAAABYAAACHS94bRKbyRKd5UqImf2JbAdTLQj1l" />
                                <t:ItemClass>IPM.Note</t:ItemClass>
                            </t:Message>
                            <t:Message>
                                <t:ItemId
                                    Id="AAAeAHBhbGxlLmhhbnNlbkBleDIwMDcudGVzdC5sb2NhbABGAAAAAAACtF39H9RiQ6dHcq+5l29xBwCHS94bRKbyRKd5UqImf2JbAXRGOxKBAACHS94bRKbyRKd5UqImf2JbAdTLQhT/AAA="
                                    ChangeKey="CQAAABYAAACHS94bRKbyRKd5UqImf2JbAdTLQjlA" />
                                <t:ItemClass>IPM.Note</t:ItemClass>
                            </t:Message>
                        </t:Items>
                    </m:RootFolder>
                </m:FindItemResponseMessage>
            </m:ResponseMessages>
        </m:FindItemResponse>
    </soap:Body>
</soap:Envelope>


EMAIL THAT IS NOT FOUND
?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:Header>
        <t:ServerVersionInfo MajorVersion="8" MinorVersion="0"
            MajorBuildNumber="783" MinorBuildNumber="2"
            xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types" />
    </soap:Header>
    <soap:Body>
        <m:GetItemResponse
            xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types"
            xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages">
            <m:ResponseMessages>
                <m:GetItemResponseMessage ResponseClass="Success">
                    <m:ResponseCode>NoError</m:ResponseCode>
                    <m:Items>
                        <t:Message>
                            <t:ItemId
                                Id="AAAeAHBhbGxlLmhhbnNlbkBleDIwMDcudGVzdC5sb2NhbABGAAAAAAACtF39H9RiQ6dHcq+5l29xBwCHS94bRKbyRKd5UqImf2JbAXRGOxJ/AACHS94bRKbyRKd5UqImf2JbAdTLQfzeAAA="
                                ChangeKey="CQAAABYAAACHS94bRKbyRKd5UqImf2JbAdTLQjk5" />
                            <t:ParentFolderId
                                Id="AAAeAHBhbGxlLmhhbnNlbkBleDIwMDcudGVzdC5sb2NhbAAuAAAAAAACtF39H9RiQ6dHcq+5l29xAQCHS94bRKbyRKd5UqImf2JbAXRGOxJ/AAA="
                                ChangeKey="AQAAAA==" />
                            <t:Subject>test email</t:Subject>
                            <t:Body BodyType="Text">cvnbxcnxcn</t:Body>
                            <t:DateTimeReceived>
                                2009-03-09T08:31:21Z
                            </t:DateTimeReceived>
                            <t:Importance>Normal</t:Importance>
                            <t:IsDraft>false</t:IsDraft>
                            <t:DateTimeSent>
                                2009-03-09T08:30:53Z
                            </t:DateTimeSent>
                            <t:DateTimeCreated>
                                2009-03-09T08:31:21Z
                            </t:DateTimeCreated>
                            <t:HasAttachments>false</t:HasAttachments>
                            <t:Sender>
                                <t:Mailbox>
                                    <t:Name>en_FTU1</t:Name>
                                    <t:EmailAddress>
                                        en_FTU1@ex2007.test.local
                                    </t:EmailAddress>
                                    <t:RoutingType>SMTP</t:RoutingType>
                                </t:Mailbox>
                            </t:Sender>
                            <t:ToRecipients>
                                <t:Mailbox>
                                    <t:Name>Palle Hansen</t:Name>
                                    <t:EmailAddress>
                                        palle.hansen@ex2007.test.local
                                    </t:EmailAddress>
                                    <t:RoutingType>SMTP</t:RoutingType>
                                </t:Mailbox>
                            </t:ToRecipients>
                            <t:From>
                                <t:Mailbox>
                                    <t:Name>en_FTU1</t:Name>
                                    <t:EmailAddress>
                                        en_FTU1@ex2007.test.local
                                    </t:EmailAddress>
                                    <t:RoutingType>SMTP</t:RoutingType>
                                </t:Mailbox>
                            </t:From>
                            <t:IsRead>true</t:IsRead>
                        </t:Message>
                    </m:Items>
                </m:GetItemResponseMessage>
            </m:ResponseMessages>
        </m:GetItemResponse>
    </soap:Body>
</soap:Envelope>

解决方案

As of today, the problem seems to have vanished. I don't know if the Exchange system has been modified in any way, but my code haven't. Strange...


这篇关于搜索在已发送邮件中查找邮件,但不在收件箱中查找的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆