我正在尝试将文本文件 myFile.txt 上传到 SkyDrive。下面是代码:
private async void btnUpload_Click( object sender, System.Windows.RoutedEventArgs e )
{
Client = new LiveConnectClient( _session );
string filename = "myFile.txt";
var isolatedstorageFile= await ApplicationData.Current.LocalFolder.CreateFileAsync( filename, CreationCollisionOption.ReplaceExisting );
using ( StreamWriter writer = new StreamWriter( await isolatedstorageFile.OpenStreamForWriteAsync() ) )
{
// convert to string
var _String = Serialize( "this is a test file" );
await writer.WriteAsync( _String );
}
await Client.BackgroundUploadAsync( FolderID, new Uri( isolatedstorageFile.Path ), OverwriteOption.Overwrite );
}
FolderID 是全局的,其值为:“folder.17ff6230f5f26b89.17FF6230F5F26B89!1533”
问题在于定义BackgroundUploadAsync 的第二个参数。如何解决它,即指定“myFile.txt”IsolatedStorage 文件所在的 URI?
谢谢,