microsoftgraph / microsoftgraph/msgraph-sdk-php

Get email attachment that is itself an email

Open
#1,428 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

question
Dominant language
PHP
Stars
669
Forks
150
Avg merge
15h 21m
Merged PRs (30d)
3

Description

In the new version when an email has an attachment, but that attachment is itself an email, then this is handled as an 'Item'.

It does not have the standard properties like ContentBytes and ContentId.
I would however like to download this file/item programatically but things like $emailAttachment->getContentBytes(); do not work.

I've also tried getting creative like:

$fileContents = $graphServiceClient->users()->byUserId($user_id)->messages()->byMessageId($email->getId())->attachments()->byAttachmentId($emailAttachment->getId())->content()->get()->wait();

But alas, still not working.
Any ideas?

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 attachment and content request paths shown in the issue, including getContentBytes() and the attachments()->byAttachmentId()->content() call. Check how an email attachment represented as an Item is modeled and whether the SDK exposes a download path for it. Done means programmatic retrieval works for this attachment type and is covered by a regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
api
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.