Advertisement
Guest User

Untitled

a guest
Jul 27th, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. var binaryData = File.ReadAllText(@"E:teststream.txt");
  2. byte[] byteArray = Convert.FromBase64String(binaryData);
  3. File.WriteAllBytes(@"E:testfile.pdf", byteArray);
  4.  
  5. byte[] data;
  6.  
  7. data = File.ReadAllBytes(@"E:teststream.txt");
  8. string base64 = System.Text.Encoding.ASCII.GetString(data);
  9. data = Convert.FromBase64String(base64);
  10. File.WriteAllBytes(@"E:testfile.pdf", data);
  11.  
  12. var attachments = (from a in cc.CRMContext.ActivityMimeAttachments where a.ActivityId == email.ActivityId select a).ToList();
  13. foreach (var attachment in attachments)
  14. {
  15. byte[] byteArray = Convert.FromBase64String(attachment.Body);
  16. System.IO.File.WriteAllBytes(@"E:testtemp" + attachment.FileName, byteArray);
  17. }
  18.  
  19. var binaryData = File.ReadAllText(@"E:teststream.txt");
  20. byte[] byteArray = Convert.FromBase64String(binaryData.Replace(' ', '+'));
  21. File.WriteAllBytes(@"E:testfile.pdf", byteArray);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement