In reply to: Markus Jenni
                            
                            Hi Tom
I've created some actions handling attachments. Adding an attachment should be quite easy by accessing the attachment via the context.
E.g.             args.Context.CurrentDocument.Attachments.AddNew(this.Configuration.AttachmentName, filledPdf);
The variable filledPdf is of type byte[]
For updates you have to use the DocumentsAttachmentsManager.
var attachmentManager = new DocumentAttachmentsManager(args.Context);
var newAttachment = attachmentManager.GetAttachment(newAttachmentId);
Change whatever you need to change
                     attachmentManager.UpdateAttachment(new UpdateAttachmentParams() { Attachment = newAttachment });
                        
                    
                    
                        
                            Thanks you. that works! Here is the whole custom action:
        public override void Run(RunCustomActionParams args)
        {
            _args = args;
            try
            {
                debug($"Starting RTF2Word action.");
                var attachmentManager = new DocumentAttachmentsManager(args.Context);
                var newAttachment = attachmentManager.GetAttachment(Configuration.RTF2WordAttachmentId);
                // replace placeholder text
                newAttachment.Content = ReplaceRTFContent(newAttachment.Content, @"$TEXTPLACEHOLDER$");
                attachmentManager.UpdateAttachment(new UpdateAttachmentParams() { Attachment = newAttachment });
                debug($"  RTF2Word isPublished: " + newAttachment.IsPublished);
            }
            catch (Exception e)
            {
                info($"ERROR generating RTF2Word: {e.Message}");
                args.HasErrors = true;
                args.Message = e.Message;
            }
            finally
            {
                debug($"Finished RTF2Word action.");
            }
        }
Code seems to run fine, no errors.