Announcements
No record found.
Hello exports,
when i try to assign string value to stream, i get the error of data convert :
Cannot implicitly convert from type 'str' to type 'System.IO.Stream'
How i can resolve the problem please ?
Thanks
System.Byte[] byteArray = System.Text.Encoding::get_UTF8().GetBytes(contents); System.IO.MemoryStream stream = new System.IO.MemoryStream(byteArray);
Note: You can find the original at the link below. I wrote it in the Editor for X . There may be minor differences.
stackoverflow.com/.../convert-string-to-system-io-stream
By the way, the variable name (invoicePath) suggests that it contains just a path, not the content of the file. Are you sure that what you want to attach is just the text with the path? If you want to attach the whole file, you need to read it from the path (and assign the content, not the path, to the stream).
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.
Congratulations to our 2026 Super Stars!
We are thrilled to have these Champions in our Community!
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Giorgio Bonacorsi 616
André Arnaud de Cal... 460 Super User 2026 Season 1
Syed Haris Shah 331 Super User 2026 Season 1