Share via

Null FileStream CSOM

developer sp1 461 Reputation points
2020-08-03T06:54:54.327+00:00

In SharePoint Remote Event Receiver, I'm try to get file stream from a ListItem:

List docs = clientContext.Web.Lists.GetById(listId);
ListItem item = docs.GetItemById(listItemId);
clientContext.Load(item);
clientContext.ExecuteQuery();
var file = item.File.OpenBinaryStream();

But it's returning null, is this limitation in Event Receiver ? I used to use this code in Console, it's working.

Please help to resolve it.

Microsoft 365 and Office | SharePoint Server | Development
0 comments No comments

Answer accepted by question author

ZhengyuGuo 10,591 Reputation points Moderator
2020-08-04T01:35:31.757+00:00

Hi @developer1-9584,

Please try to get the file stream like the code as attachment.

15352-getfilestream.txt

Was this answer helpful?

1 person found this answer helpful.
0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

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