Skip to content
This repository has been archived by the owner on Jun 18, 2024. It is now read-only.

Not list folders in WellKnownFolderName.Inbox #487

Open
yonus opened this issue Jan 29, 2016 · 1 comment
Open

Not list folders in WellKnownFolderName.Inbox #487

yonus opened this issue Jan 29, 2016 · 1 comment

Comments

@yonus
Copy link

yonus commented Jan 29, 2016

Hello ,
I want to list folder in Inbox as following code, I get error as following.

FolderView folderView = new FolderView(100);
FindFoldersResults results = service.findFolders(WellKnownFolderName.Inbox, folderView);

Error:
microsoft.exchange.webservices.data.core.exception.service.remote.ServiceRequestException: The request failed. The request failed schema validation: The 'Id' attribute is invalid - The value 'ınbox' is invalid according to its datatype 'http://schemas.microsoft.com/exchange/services/2006/types:DistinguishedFolderIdNameType' - The Enumeration constraint failed.
at microsoft.exchange.webservices.data.core.request.SimpleServiceRequestBase.internalExecute(SimpleServiceRequestBase.java:74)
at microsoft.exchange.webservices.data.core.request.MultiResponseServiceRequest.execute(MultiResponseServiceRequest.java:158)
at microsoft.exchange.webservices.data.core.ExchangeService.internalFindFolders(ExchangeService.java:377)
at microsoft.exchange.webservices.data.core.ExchangeService.findFolders(ExchangeService.java:425)
at microsoft.exchange.webservices.data.core.ExchangeService.findFolders(ExchangeService.java:461)
at com.teb.pusula.calendar.service.CalenderService.getCalenderFolderds(CalenderService.java:94)
at com.teb.pusula.calendar.service.Main.main(Main.java:14)
Caused by: microsoft.exchange.webservices.data.core.exception.service.remote.ServiceResponseException: The request failed schema validation: The 'Id' attribute is invalid - The value 'ınbox' is invalid according to its datatype 'http://schemas.microsoft.com/exchange/services/2006/types:DistinguishedFolderIdNameType' - The Enumeration constraint failed.
at microsoft.exchange.webservices.data.core.request.ServiceRequestBase.processWebException(ServiceRequestBase.java:548)
at microsoft.exchange.webservices.data.core.request.ServiceRequestBase.validateAndEmitRequest(ServiceRequestBase.java:641)
at microsoft.exchange.webservices.data.core.request.SimpleServiceRequestBase.internalExecute(SimpleServiceRequestBase.java:62)
... 6 more

@vardaru
Copy link

vardaru commented Mar 26, 2016

I gor the same error while trying access WellKnownFolderName.INBOX. My locale was ISO_8859 (turkish).
In writeAttributesToXml function of FolderId.java there is a toLowerCase() usage. That is the cause of the problem because "I".toLowercase()=="ı" (i without dot on top) in turkish.
So I changed that code as:
...

public void writeAttributesToXml(EwsServiceXmlWriter writer)
      throws ServiceXmlSerializationException {
    if (this.getFolderName() != null) {
      writer.writeAttributeValue(XmlAttributeNames.Id, this
          .getFolderName().toString().toLowerCase(Locale.ENGLISH));
      if (this.mailbox != null) {
        try {
          this.mailbox.writeToXml(writer, XmlElementNames.Mailbox);
        } catch (Exception e) {
          throw new ServiceXmlSerializationException(e.getMessage());
        }
      }
    } else {
      super.writeAttributesToXml(writer);
    }
  }

...

It works and does not breaks any tests.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants