This code sending all attachments present in the workitem but I want to send only the latest attachments (i.e. attachment added during last update) not all attachment updated earlier. so please help me to achieve this requirement.

Please check comments in that example. For the attachments that has not been loaded yet, the file name would contain path delimiters. Newly added attachments could be distinguished this way.Another way would be to compare record to its original using CQ API, and add newly added attachments, if any.

Please check comments in that example. For the attachments that has not been loaded yet, the file name would contain path delimiters. Newly added attachments could be distinguished this way.Another way would be to compare record to its original using CQ API, and add newly added attachments, if any.

It sending only latest attachments added in the current session which worked after I removed else part(which is adding all existing attachments) from the example code provided.

but now the problem is after I connected RTC(Rational Team Concert) to CQ, if I add any attachments in RTC it get synched to CQ but not sending with mail. If I enabled that else condition again(which I removed earlier for send only latest attachments) then it sending all the attachments as well as current session attachment added through RTC.

I want to send only the latest attachments which added from RTC in the current update. Please help me for this requirement.

It would require some codding and testing. If file path approach does not work, I would try to implement comparison of the current entity object attachments with attachments of the same record entity stored in the database (accessible with LoadEntity session object method).