/// <summary> /// Uploads a stream to a block blob in a storage account associated with the IoTHub for that device. /// If the blob already exists, it will be overwritten. /// </summary> /// <param name="blobName"></param> /// <param name="source"></param> /// <returns>AsncTask</returns> public AsyncTask UploadToBlobAsync(String blobName, System.IO.Stream source) { if (String.IsNullOrEmpty(blobName)) { throw Fx.Exception.ArgumentNull("blobName"); } if (source == null) { throw Fx.Exception.ArgumentNull("source"); } var httpTransport = new HttpTransportHandler(iotHubConnectionString); return(httpTransport.UploadToBlobAsync(blobName, source)); }
/// <summary> /// Uploads a stream to a block blob in a storage account associated with the IoTHub for that device. /// If the blob already exists, it will be overwritten. /// </summary> /// <param name="blobName"></param> /// <param name="source"></param> /// <returns>AsncTask</returns> public AsyncTask UploadToBlobAsync(String blobName, System.IO.Stream source) { if (String.IsNullOrEmpty(blobName)) { throw Fx.Exception.ArgumentNull("blobName"); } if (source == null) { throw Fx.Exception.ArgumentNull("source"); } if (blobName.Length > 1024) { throw Fx.Exception.Argument("blobName", "Length cannot exceed 1024 characters"); } if (blobName.Split('/').Count() > 254) { throw Fx.Exception.Argument("blobName", "Path segment count cannot exceed 254"); } var httpTransport = new HttpTransportHandler(iotHubConnectionString); return(httpTransport.UploadToBlobAsync(blobName, source)); }