microsoftgraph / microsoftgraph/msgraph-sdk-go

Is there a way to post a raw RFC 5322 message to the create message endpoint?

Open
#701 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Needs Attention :wave:
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/json for a JSON object and text/plain for 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.