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

Unable to update CategoryList #114

@aglueck

Description

@aglueck

Hello,

I'm trying to update the CategoryList but I can not get further because the UserConfiguration's setter for XmlData wants me to set a Base64 encoded ByteArray. Unfortunately a subsequent request returns a Base64 encoded ByteArray, but I'm expecting a plain XML just as in the first call.

Can you tell me, if there's something wrong? I'm accessing an Exchange 2010.

Here's the sample code I've written:

    UserConfiguration configuration = UserConfiguration.bind(service, "CategoryList", 
    WellKnownFolderName.Calendar, UserConfigurationProperties.XmlData);

    JAXBContext jaxbContext = JAXBContext.newInstance(Categories.class);
    Unmarshaller unmarshaller =  jaxbContext.createUnmarshaller();

    ByteArrayInputStream bais = new ByteArrayInputStream(configuration.getXmlData());
    Categories c = (Categories) unmarshaller.unmarshal(bais);

    Category newCat = new Category();
    newCat.setName("New Category");
    newCat.setColor(24);
    newCat.setKeyboardShortcut(0);
    newCat.setGuid(UUID.randomUUID().toString());
    newCat.setLastSessionUsed(0);

    c.getCategory().add(newCat);

    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    Marshaller marshaller = jaxbContext.createMarshaller();
    marshaller.marshal(c, baos);

    byte[] content = baos.toByteArray();

    configuration.setXmlData(Base64.encodeBase64(content));
    configuration.update();

Thanks in advance,

Adam

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions