Currently the way that SendMail is defined, it is not obvious how to send a message with attachments.
Message is defined with Attachments: []Attachment; but when you pass an Attachment object to the API, you must provide either a FileAttachment or an ItemAttachment. In my case I wanted to provide a FileAttachment, which requires setting the ContentBytes field, which is not present on the Attachment struct.
I realize this is somewhat of a problem with representing the graph data-types (which make use of subclassing) in Go (which doesn't); and wondered if you'd given this some thought already – it's definitely not clear what the right solution is. Maybe an AddFileAttachment(file *FileAttachment) method on SendMailRequestBuilder?
Currently the way that SendMail is defined, it is not obvious how to send a message with attachments.
Messageis defined withAttachments: []Attachment; but when you pass an Attachment object to the API, you must provide either a FileAttachment or an ItemAttachment. In my case I wanted to provide aFileAttachment, which requires setting theContentBytesfield, which is not present on theAttachmentstruct.I realize this is somewhat of a problem with representing the graph data-types (which make use of subclassing) in Go (which doesn't); and wondered if you'd given this some thought already – it's definitely not clear what the right solution is. Maybe an
AddFileAttachment(file *FileAttachment)method onSendMailRequestBuilder?