EWS FindItem call returns incorrect EffectiveRights values

P44T

I'm using a FindItem call to get items (appointments) from Exchange Web Services (EWS). The properties which are fetched are the item Id and the EffectiveRights. The EffectiveRights property often does not contain the correct values. Sometimes, however, the values are correct (using the same code), but I don't know what causes this.

The Calendar folder I'm searching in is delegated with Author rights to the service user I authenticate with and it contains appointments of which this service user is the author of.

I'm using the ews-java-api library and the response traces show that this isn't a parsing bug.

The code used to retrieve the items:

ItemView view = new ItemView(100);
PropertySet propertySet = new PropertySet();
propertySet.add(ItemSchema.Id);
propertySet.add(ItemSchema.EffectiveRights);
view.setPropertySet(propertySet);

FolderId folderId = new FolderId(WellKnownFolderName.Calendar, Mailbox.getMailboxFromString(targetSmtpAddress));
FindItemsResults<Item> items = service.findItems(folderId, filter, view);

Item firstItem = items.getItems().get(0);
firstItem.getEffectiveRights(); // Returns NONE, READ. This is incorrect.

Item bindItem = Item.bind(service, firstItem.getId()); // 
bindItem.getEffectiveRights(); // Returns NONE, READ, MODIFY, DELETE. This is correct.

The request trace:

<?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:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
    <soap:Header>
        <t:RequestServerVersion Version="Exchange2010_SP2"></t:RequestServerVersion>
    </soap:Header>
    <soap:Body>
        <m:FindItem Traversal="Shallow">
            <m:ItemShape>
                <t:BaseShape>IdOnly</t:BaseShape>
                <t:AdditionalProperties>
                    <t:FieldURI FieldURI="item:ItemId"></t:FieldURI>
                    <t:FieldURI FieldURI="item:EffectiveRights"></t:FieldURI>
                </t:AdditionalProperties>
            </m:ItemShape>
            <m:IndexedPageItemView MaxEntriesReturned="1000" Offset="0" BasePoint="Beginning"></m:IndexedPageItemView>
            <m:Restriction>
                <t:And>
                    <t:IsEqualTo>
                        <t:ExtendedFieldURI PropertySetId="039b4d91-2f03-44da-887c-aad704243ba8" PropertyName="SyncId" PropertyType="String"></t:ExtendedFieldURI>
                        <t:FieldURIOrConstant>
                            <t:Constant Value="syncID:330"></t:Constant>
                        </t:FieldURIOrConstant>
                    </t:IsEqualTo>
                    <t:IsGreaterThanOrEqualTo>
                        <t:FieldURI FieldURI="calendar:Start"></t:FieldURI>
                        <t:FieldURIOrConstant>
                            <t:Constant Value="2015-01-28T13:53:38Z"></t:Constant>
                        </t:FieldURIOrConstant>
                    </t:IsGreaterThanOrEqualTo>
                </t:And>
            </m:Restriction>
            <m:ParentFolderIds>
                <t:DistinguishedFolderId Id="calendar">
                    <t:Mailbox>
                        <t:EmailAddress>[email protected]</t:EmailAddress>
                    </t:Mailbox>
                </t:DistinguishedFolderId>
            </m:ParentFolderIds>
        </m:FindItem>
    </soap:Body>
</soap:Envelope>

The trace of a 'faulty' response:

<?xml version="1.0" encoding="utf-8"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
    <s:Header>
        <h:ServerVersionInfo MajorVersion="14" MinorVersion="3" MajorBuildNumber="224" MinorBuildNumber="2" Version="Exchange2010_SP2" xmlns:h="http://schemas.microsoft.com/exchange/services/2006/types" xmlns="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"/>
    </s:Header>
    <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
        <m:FindItemResponse xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
            <m:ResponseMessages>
                <m:FindItemResponseMessage ResponseClass="Success">
                    <m:ResponseCode>NoError</m:ResponseCode>
                    <m:RootFolder IndexedPagingOffset="1000" TotalItemsInView="1868" IncludesLastItemInRange="false">
                        <t:Items>
                            <t:CalendarItem>
                                <t:ItemId Id="AAMkAGVlZmVlY2JjLTcxOTItNDBkYi1hOTljLTkwZjQwZjE4MTU1NQBGAAAAAADZ8IosQv76QbxS0r8FeFzgBwB25IsPmJcKTaP6zvCUqaybAAAAoIe5AAB25IsPmJcKTaP6zvCUqaybAABcSsgnAAA=" ChangeKey="DwAAABYAAAB25IsPmJcKTaP6zvCUqaybAABcS6ER"/>
                                <t:EffectiveRights>
                                    <t:CreateAssociated>false</t:CreateAssociated>
                                    <t:CreateContents>false</t:CreateContents>
                                    <t:CreateHierarchy>false</t:CreateHierarchy>
                                    <t:Delete>false</t:Delete>
                                    <t:Modify>false</t:Modify>
                                    <t:Read>true</t:Read>
                                    <t:ViewPrivateItems>false</t:ViewPrivateItems>
                                </t:EffectiveRights>
                            </t:CalendarItem>
                            <t:CalendarItem>
                                <t:ItemId Id="AAMkAGVlZmVlY2JjLTcxOTItNDBkYi1hOTljLTkwZjQwZjE4MTU1NQBGAAAAAADZ8IosQv76QbxS0r8FeFzgBwB25IsPmJcKTaP6zvCUqaybAAAAoIe5AAB25IsPmJcKTaP6zvCUqaybAABcSsglAAA=" ChangeKey="DwAAABYAAAB25IsPmJcKTaP6zvCUqaybAABcS6EN"/>
                                <t:EffectiveRights>
                                    <t:CreateAssociated>false</t:CreateAssociated>
                                    <t:CreateContents>false</t:CreateContents>
                                    <t:CreateHierarchy>false</t:CreateHierarchy>
                                    <t:Delete>false</t:Delete>
                                    <t:Modify>false</t:Modify>
                                    <t:Read>true</t:Read>
                                    <t:ViewPrivateItems>false</t:ViewPrivateItems>
                                </t:EffectiveRights>
                            </t:CalendarItem>

                            <!-- MORE ITEMS HERE... -->

                        </t:Items>
                    </m:RootFolder>
                </m:FindItemResponseMessage>
            </m:ResponseMessages>
        </m:FindItemResponse>
    </s:Body>
</s:Envelope>

I already found this blog post which seems somewhat related, but nothing more than that.

Jason Johnston

FindItems loads values from the contents table of a folder, rather than from the items themselves. Many times, with computed properties like EffectiveRights, a simplistic approach is used to populate the table to give an approximation. It seems like that's what's happening here. The comment in your code mentions that the value is correct after you Bind to the item (which loads values from the item itself).

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

EWS: Unsupported restriction in FindItem request exception

Dictionary of Objects returns incorrect values

OpenGL - glReadPixels returns incorrect values

checkPrime function returns incorrect values

eigen eulerAngles() returns incorrect values

numpy.vectorize returns incorrect values

Android MediaPlayer.getCurrentPosition() returns incorrect values

Javascript date calculation returns incorrect values

Function returns incorrect False (only at higher values)

Execution of Stored Procedure in .NET application using SQLQuery returns incorrect values

Adding numbers within a range of root values returns incorrect value

Reading an array from a binary file in c returns incorrect values

Newtonsoft.Json returns incorrect values from file (with DeserializeObject)

ajax call returns values and my html page

Keychain returns different values in each call

Webscraping call in python returns empty values

Redshift returns a []uint8 instead of an integer, converting between them returns incorrect values

Why does Scipy sparse implementation returns incorrect number of singular values although dense one returns correct?

toLocaleString() returns incorrect time

`cublasIsamin` returns an incorrect value

getApplicationLabel returns incorrect label

Regex returns with incorrect value

SSIS returns an incorrect error

AccessibleObjectFromPoint() returns an incorrect object

getMonth returns incorrect value

Incorrect value returns

Javascript and PHP ajax call with multiple return values returns undefined

C generates correct shell command, but system() call returns unexpected values

Reading columns out of order returns incorrect values (SQL Server ODBC driver)