You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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?
The text was updated successfully, but these errors were encountered:
I hit this problem, except in the reverse order. When I am attempting to read the content of an attachment for a message, I'm seeing contentBytes in the underlying interface via dump(attachment) but there is no ContentBytes field on said struct.
@ConradIrwin after messing around I finally realized that the Object struct has an AdditionalData map[string]interface{} that contains all the extra fields not present in the leaf structs. For example, I was able to access attachedFile.AdditionalData["contentBytes"] to read - perhaps you can use it for write as well?
Currently the way that SendMail is defined, it is not obvious how to send a message with attachments.
Message
is 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 theContentBytes
field, which is not present on theAttachment
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 onSendMailRequestBuilder
?The text was updated successfully, but these errors were encountered: