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 Security Microsoft Graph
0 comments No comments
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.