none
[E2010] [EWS Java API 1.1][JAVA] - How to use the extended property definition to getting the folder size in EWS Java API? RRS feed

  • Question

  • Hi,

    I am trying to get the folder size information about a folder. Since there is no ManagedFolderInformation for normal folders, I am trying to use an extendedPropertyDefinition for this.. Please check the below code.

        PropertyDefinitionBase folderSizeProperty = new ExtendedPropertyDefinition( 3592, MapiPropertyType.Long );
    
        service.setTraceEnabled( true );
        Folder folder = Folder.bind( service, WellKnownFolderName.Inbox, new PropertySet( BasePropertySet.IdOnly, folderSizeProperty ) );
        System.out.println( folder.getExtendedPropertiesForService().getPropertyAtIndex( 0 ).getValue() );

    Then the Folder.bind is throwing the following exception.

    Exception in thread "main" microsoft.exchange.webservices.data.ServiceRequestException: The request failed. For input string: "0xe08"
    	at microsoft.exchange.webservices.data.SimpleServiceRequestBase.internalExecute(SimpleServiceRequestBase.java:52)
    	at microsoft.exchange.webservices.data.MultiResponseServiceRequest.execute(MultiResponseServiceRequest.java:140)
    	at microsoft.exchange.webservices.data.ExchangeService.bindToFolder(ExchangeService.java:349)
    	at microsoft.exchange.webservices.data.ExchangeService.bindToFolder(ExchangeService.java:374)
    	at microsoft.exchange.webservices.data.Folder.bind(Folder.java:49)
    	at microsoft.exchange.webservices.data.Folder.bind(Folder.java:90)
    	at test.ExtendedPropertiesFolder.main(ExtendedPropertiesFolder.java:27)
    Caused by: java.lang.NumberFormatException: For input string: "0xe08"
    	at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
    	at java.lang.Integer.parseInt(Integer.java:458)
    	at microsoft.exchange.webservices.data.ExtendedPropertyDefinition.loadFromXml(ExtendedPropertyDefinition.java:275)
    	at microsoft.exchange.webservices.data.ExtendedProperty.tryReadElementFromXml(ExtendedProperty.java:61)
    	at microsoft.exchange.webservices.data.ComplexProperty.loadFromXml(ComplexProperty.java:182)
    	at microsoft.exchange.webservices.data.ComplexProperty.loadFromXml(ComplexProperty.java:211)
    	at microsoft.exchange.webservices.data.ExtendedPropertyCollection.loadFromXml(ExtendedPropertyCollection.java:64)
    	at microsoft.exchange.webservices.data.ComplexPropertyDefinitionBase.internalLoadFromXml(ComplexPropertyDefinitionBase.java:95)
    	at microsoft.exchange.webservices.data.ComplexPropertyDefinitionBase.loadPropertyValueFromXml(ComplexPropertyDefinitionBase.java:118)
    	at microsoft.exchange.webservices.data.PropertyBag.loadFromXml(PropertyBag.java:487)
    	at microsoft.exchange.webservices.data.ServiceObject.loadFromXml(ServiceObject.java:268)
    	at microsoft.exchange.webservices.data.EwsServiceXmlReader.readServiceObjectsCollectionFromXml(EwsServiceXmlReader.java:212)
    	at microsoft.exchange.webservices.data.GetFolderResponse.readElementsFromXml(GetFolderResponse.java:53)
    	at microsoft.exchange.webservices.data.ServiceResponse.loadFromXml(ServiceResponse.java:101)
    	at microsoft.exchange.webservices.data.MultiResponseServiceRequest.parseResponse(MultiResponseServiceRequest.java:52)
    	at microsoft.exchange.webservices.data.ServiceRequestBase.readResponse(ServiceRequestBase.java:445)
    	at microsoft.exchange.webservices.data.SimpleServiceRequestBase.readResponse(SimpleServiceRequestBase.java:93)
    	at microsoft.exchange.webservices.data.SimpleServiceRequestBase.internalExecute(SimpleServiceRequestBase.java:39)
    	... 6 more

    If I check the response send back by the server, it contains the folder size information, EWS API could not get it.

    In the ExtendedPropertyDefinition class where the exception is happening, the following is the snippet.

    		attributeValue = reader.readAttributeValue(XmlAttributeNames.PropertyTag);
    		if (null != attributeValue && !attributeValue.isEmpty()) {
    
    			this.tag = Integer.parseInt(attributeValue, 16);
    		}
    Here the attributeValue is "0xe08". The the Integer.parseInt("0xe08") throws the NumberFormatException. Integer.parseInt("0e08") does not cause any problem.

    I think, then this would be a problem for getting any extendedProperties of type Integer, Long, Short etc.

    If anyone has faced this problem and worked around it, please help me. It is a critical issue for us, any help would be great.

    Thanks,

    Paul

     

     

     

    Friday, March 11, 2011 2:17 PM

Answers

  • Hi PaulNibin and khitrenovich , I wanted to let you know that we have an updated version (1.1.2) is  available with a change to address your issue "The extended property definition for getting the folder size in EWS Java API". Please let us know if you have any questions or problems using the updated version.  Thank you for using EWS Java API and for your feedback!

    • Marked as answer by PaulNibin Wednesday, August 17, 2011 7:58 AM
    Monday, May 23, 2011 2:36 PM

All replies

  • Just adding the EWS responsereceived for reference.

    <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
    	<s:Header>
    		<h:ServerVersionInfo MajorVersion="14" MinorVersion="1" MajorBuildNumber="218" MinorBuildNumber="14" Version="Exchange2010_SP1" 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:GetFolderResponse xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
    			<m:ResponseMessages>
    				<m:GetFolderResponseMessage ResponseClass="Success">
    					<m:ResponseCode>NoError</m:ResponseCode>
    					<m:Folders>
    						<t:Folder>
    							<t:FolderId Id="AAMkADRjYTg2ZDFhLWFiNmItNDZjNC1iOGI1LTE2ZDdiY2I3YjVlNAAuAAAAAABgw+wi1GxZRJ8f7TY0MaoOAQDUNmqIPGloSaurMG41WjMaAAAAjRT2AAA=" ChangeKey="AQAAABYAAACOm9QySEvZT7zAEfIxnMxuAAAAAXPz"/>
    							<t:ExtendedProperty>
    								<t:ExtendedFieldURI PropertyTag="0xe08" PropertyType="Long"/>
    								<t:Value>502002</t:Value>
    							</t:ExtendedProperty>
    						</t:Folder>
    					</m:Folders>
    				</m:GetFolderResponseMessage>
    			</m:ResponseMessages>
    		</m:GetFolderResponse>
    	</s:Body>
    </s:Envelope>

    Friday, March 11, 2011 2:18 PM
  • You are not alone - I see the same issue...

    Regards,

    Anton.

    Thursday, March 31, 2011 9:01 PM
  • Hi PaulNibin and khitrenovich , I wanted to let you know that we have an updated version (1.1.2) is  available with a change to address your issue "The extended property definition for getting the folder size in EWS Java API". Please let us know if you have any questions or problems using the updated version.  Thank you for using EWS Java API and for your feedback!

    • Marked as answer by PaulNibin Wednesday, August 17, 2011 7:58 AM
    Monday, May 23, 2011 2:36 PM
  • Hi Anand,

     

    This issue is resolved now. I have verified the issue with the release EWS1.1.4. It is working fine.

     

    Thanks you,

    Paul Nibin

    Wednesday, August 17, 2011 6:37 AM