Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot add multiple categories to a task #372

Open
KomtGoed opened this issue Nov 24, 2024 · 9 comments
Open

Cannot add multiple categories to a task #372

KomtGoed opened this issue Nov 24, 2024 · 9 comments

Comments

@KomtGoed
Copy link

Hi,

I'm using davmail through Thunderbird.

When creating a task, I usually assign two categories, i.e. a priority and a type of category. This worked fine while I was using TbSync to connect to Exchange.

Since using davmail, I cannot assign two categories anymore. Thunderbird displays both categories before saving but after saving, only one of the two categories is included on the task. The second category can be added through OWA.

Interestingly enough, retrieving and displaying multiple categories from existing (pre-davmail) tasks works fine, as with tasks "enhanced" through OWA.

Is this potentially related to the following issue: #178 ?

Thanks!

@esabol
Copy link

esabol commented Nov 24, 2024

Is this potentially related to the following issue: #178 ?

It sure seems like it to me, @KomtGoed. Would you be up to compiling a modified version of DavMail yourself to test this?

The change seems super-easy to implement. Just edit src/java/davmail/exchange/VProperty.java, go to line 36, and insert the following lines:

        MULTIVALUED_PROPERTIES.add("CATEGORIES");
        MULTIVALUED_PROPERTIES.add("FREEBUSY");
        MULTIVALUED_PROPERTIES.add("RECUR");

@KomtGoed
Copy link
Author

Thanks for the quick response.

I tried but it didn't seem to fix the issue.

  • Cloned repo
  • Added the three lines
  • ant
  • uninstalled the davmail-server deb package (SID backport to LMDE 6)
  • Installed the self-built deb package
  • Test for general connectivity = fine
  • Created a task with two categories: still only the first category is transferred to Exchange

Do you have any other ideas? Thanks a lot!

@esabol
Copy link

esabol commented Nov 25, 2024

@KomtGoed wrote:

Do you have any other ideas?

Not really. I'm surprised that didn't work, tbh. You'll need to wait for someone more knowledgeable, i.e. @mguessan, to take a look, I think.

@esabol
Copy link

esabol commented Nov 25, 2024

A WIRE debug log of the interaction between your modified version of DavMail and Thunderbird might help. Check the first FAQ here:

https://davmail.sourceforge.net/faq.html#Feedback

Edit your ~/.davmail.properties file and add the following lines to the file:

log4j.logger.httpclient.wire=DEBUG
log4j.logger.org.apache.http.wire=DEBUG

Quit and restart the DavMail application. Then have your mail program connect to DavMail and try to create another task with multiple categories. DavMail will then create a detailed log of what it is doing. This log will be stored in a davmail.log file. By default, it will be located in DavMail's current working directory on Linux and Windows. This log file might include authentication information like your password and other account details that you should not share online. If you are confident you can remove those things from the davmail.log file, feel free to post the sanitized file here. Otherwise, send the log file to [email protected] along with the URL of this GitHub issue. I hope this helps!

@KomtGoed
Copy link
Author

KomtGoed commented Dec 1, 2024

Took me a bit to figure out that the sid backport for davmail-server seems to ignore the davmail.logFilePath = , e.g. /var/log/davmail.log and does not seem to generate a logfile elsewhere.

Used the previous self-compiled version in the end (i.e. with the changes suggested by esabol). Please find attached the log file.
The task created is called blahblah, the real creation seems to be triggered in line 1278 (after an unsuccessful attempt in 1254).

logging_task.log

Hope this gives some more hints, happy to help investigating further.

@esabol
Copy link

esabol commented Dec 1, 2024

What categories did you set when you created the task, @KomtGoed ? I can't find any categories in the log.

@KomtGoed
Copy link
Author

KomtGoed commented Dec 4, 2024

Did start from scratch. Clean repo clone, recompiled (without the MULTIVALUED_PROPERTIES lines).

Now the categories are included. You nicely see three categories being sent, but only one (category is actually called "1") received back.
Got the same behavior with text only categories.

davmail.log

@esabol
Copy link

esabol commented Dec 4, 2024

Do you want to try some more prospective changes, @KomtGoed ?

In addition to making the changes to src/java/davmail/exchange/VProperty.java mentioned above, I would try changing src/java/davmail/exchange/ews/EwsExchangeSession.java lines 1658-1665 from this:

                List<VProperty> categories = vEvent.getProperties("CATEGORIES");
                if (categories != null) {
                    HashSet<String> categoryValues = new HashSet<>();
                    for (VProperty category : categories) {
                        categoryValues.add(category.getValue());
                    }
                    updates.add(Field.createFieldUpdate("keywords", StringUtil.join(categoryValues, ",")));
                }

to this:

                List<VProperty> categories = vEvent.getProperties("CATEGORIES");
                if (categories != null) {
                    MultiValuedFieldUpdate keywordsFieldUpdate = null;
                    for (VProperty category : categories) {
                       if (keywordsFieldUpdate == null) {
                           keywordsFieldUpdate = new MultiValuedFieldUpdate(Field.get("keywords"));
                       }
                       keywordsFieldUpdate.addValue(category.getValue());
                    }
                    if (keywordsFieldUpdate != null) {
                        updates.add(keywordsFieldUpdate);
                    }
                }

Caveat: I don't actually know what I'm doing. 😄

@KomtGoed
Copy link
Author

KomtGoed commented Dec 6, 2024

Thanks for your continued help.

I did the suggested changes... but no luck I'm afraid.
Surprised that the initial code does not work, since it seems to do the same as a multivalued field, namely produce a comma-separated list.
Tried to fiddle around myself and added a LOGGER.debug just be fore the first "if"... but does not show up in the logs.

Anyhow, I've re-activated the TBSync addon again. Works with multiple categories, but overall not ideal.

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

No branches or pull requests

2 participants