Step 1: Get Avatar from Microsoft Graph API
- Endpoint used:
bash
GET https://graph.microsoft.com/v1.0/users/{userId}/photo/$value
- Response:
- Content-Type:
image/jpeg
- Binary stream only (no file name or extension provided)
- File name defaults to
$value
when uploading to OneDrive
- Content-Type:
Step 2: Upload Image to OneDrive (via n8n)
- Used node: OneDrive → Upload File
- Issues faced:
- Even when setting a file name manually (
avatar.jpg
), the file still gets uploaded as$value
sometimes. - Sometimes the file shows without an extension or MIME type.
- Upload succeeds, but image preview or later usage becomes difficult due to naming.
- Even when setting a file name manually (
Step 3: Insert Image into Excel Online (also on OneDrive)
- Used formula inside Excel cell:
excel
Sao chépChỉnh sửa
=IMAGE("https://<sharepoint-link-to-image>")
- Tried links:
- Microsoft Graph’s
@microsoft.graph.downloadUrl
- SharePoint public links (
webUrl
) onedrive.live.com
short shareable URLs
- Microsoft Graph’s
- Tried setting file/folder public in SharePoint
- Tried using imgur for external image (
https://i.imgur.com/xyz.png
) - Results in Excel (Excel for Web):
#BLOCKED!
#CONNECT!
#FIELD!