Add and list GenericList Item attachments

Marco 0 Reputation points
2024-06-26T09:52:57.14+00:00

I need to add file attachment to a genericlist item .

On Graph api explorer I can see tha Item contains attacments but I cannot explore them.

And how can add attachment via Graph Api ? I can only do that via browser on the list item detail.

User's image

I try to do that


MemoryStream mem = ConvertBase64ToMemoryStream(attachmentFiletxt); //new MemoryStream(fileBytes);

var res = await _appClient

.Sites[siteId]

.Lists[listId]

.Items[itemId]

.DriveItem

.Content

.PutAsync(mem);

but the response is " Cannot request driveItem for an item that is not in a document library"

Is there another way to do that ?

thans

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
11,338 questions
0 comments No comments
{count} votes