Hello.
I am trying to download file from SkyDrive using web::http::client::http_client.
Please, point me what I am doing wrong.
I am trying to download file from SkyDrive using web::http::client::http_client.
std::wstring fileID = std::wstring (file_id);
Platform::String ^fName = Platform::String::Concat (ref new Platform::String (L"Users\\"), ref new Platform::String (file_name));
create_task (Windows::Storage::ApplicationData::Current->TemporaryFolder->CreateFileAsync (fName, Windows::Storage::CreationCollisionOption::ReplaceExisting))
.then ([fileID] (StorageFile ^userSave)
{
file_stream <unsigned char>::open_istream (userSave, std::ios_base::out)
.then ([fileID] (basic_istream <unsigned char> fileStream)
{
http_client client (SkyDriveHost);
std::wstring request (fileID.c_str ());
request.append (L"/content?download=true&access_token=");
request.append (token);
client.request (methods::GET, request, fileStream, 1052004, L"application/octet-stream")
.then ([fileStream] (http_response response)
{
fileStream.close ();
});
});
});
But I always get an exception after client.request.Please, point me what I am doing wrong.