Need to download image from sharepoint to D365 bitmap field by x++

It would helped if you told us where the error was.

I assume it’s on the line inside the loop - .NET Interop from X++ often doesn’t like chains of references. Try assigning file.Content to a separate variable:

System.IO.Stream fileStream = file.Content;
fileStream.CopyTo(ms);

Your statement “CopyTo is VOID and i cant assign it” sounds like you’re trying to assign a return value of CopyTo() to something, which is indeed wrong. Please look again at my code and check if you have the same.