microsoftgraph / microsoftgraph/msgraph-sdk-go
Is there a way to post a raw RFC 5322 message to the create message endpoint?
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 335
- Forks
- 43
- Avg merge
- 15h 19m
- Merged PRs (30d)
- 3
Description
I have an RFC 5322-formatted message, and I'm trying to POST it to the /users/{id | userPrincipalName}/mailFolders/{id}/messages endpoint.
Per the docs for that API, that is possible when POSTing a request to that endpoint with a content type of text/plain. Specifically, this note in the "Request headers" section for Content-Type (emphasis mine):
Use
application/jsonfor a JSON object andtext/plainfor MIME content.
Combined with this additional note in the "Request body" section:
When specifying the body in MIME format, provide the MIME content with the applicable Internet message headers ("To", "CC", "BCC", "Subject"), all encoded in base64 format in the request body.
I can't find a way to do this with the SDK. Am I missing something, or does the SDK not support this?
I'm able to get as far as this:
client.
Users().
ByUserId(userID).
MailFolders().
ByMailFolderId("inbox").
Messages().
Post(
ctx,
// This doesn't compile as it isn't `model.Messageable`.
// How do I send this?
base64.StdEncoding.EncodeToString(email),
nil,
)
A model.Messaage gets sent as application/json, and can't be built from an RFC 5322 message (as far as I can tell).
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Messages().Post entry point in the SDK and compare its model.Messageable parameter with the documented /users/{id | userPrincipalName}/mailFolders/{id}/messages endpoint. Check whether the request path can represent base64-encoded RFC 5322 content with text/plain; done means establishing SDK support or documenting the missing request path.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- api
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100