microsoftgraph/msgraph-beta-sdk-php

Download a Attachment from email

Closed this issue · 1 comments

How can I download a attachment from an email?
i have this code:

`

    foreach ($test as $item) {

        $anlage =  GraphHelper::$appClient->users()

            ->byUserId($email)

            ->messages()

            ->byMessageId($mailID)

            ->attachments()

            ->byAttachmentId($item->getId())

            ->get()

            ->wait()

        ;
    }`

but in the variable $anlage there is no content from the attachment. only getName, getContentType, .....

I have found it
`

    foreach ($attachments->getValue() as $item) {

        $anlage =  GraphHelper::$appClient->users()

            ->byUserId($email)

            ->messages()

            ->byMessageId($mailID)

            ->attachments()

            ->byAttachmentId($item->getId())

            ->get()

            ->wait()

        ;

        $ausgabe[$mailID][] = base64_decode($anlage->getContentBytes());

    }

`