Hi all,
I have a file encoded into base 64 string loaded into a string object. I need to upload that file to a different location using WebHttpRequest. How do I read that base64 encoded string and read it into a stream to be able to upload? Please check the code
below.
internal static void UploadFile(string fileName, string base64File)
{
//string fileName = Path.GetFileName(filePath);
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(Path.Combine(Utility.SP_ENV_SVC_ROOTURL + Utility.SP_EMAIL_LISTNAME, fileName));
request.Headers.Add("SOAPAction", "http://schemas.microsoft.com/xrm/2011/Contracts/Services/IOrganizationService/Execute");
request.Method = "PUT";
request.Credentials = new NetworkCredential(Utility.SP_ENV_SVC_USERNAME, Utility.SP_ENV_SVC_PASSWORD, Utility.SP_ENV_SVC_DOMAIN);
// Write the contents ...
Go to the complete details ...