Skip to main content
ApplicationData.RoamingFolder | roamingFolder property

Applies to Windows and Windows Phone

Gets the root folder in the roaming app data store.


var roamingFolder = applicationData.roamingFolder;

public StorageFolder RoamingFolder { get; }

Public ReadOnly Property RoamingFolder As StorageFolder

property StorageFolder^ RoamingFolder { 
   StorageFolder^ get();

Property value

Type: StorageFolder

The file system folder that contains the files.


The sync engine has restrictions on the file name conventions that you must follow to ensure the items in the roaming folder can roam. Be sure that your file and folder names do not contain leading whitespace. The sync engine may limit the total size of settings and files that can roam.

You can access files in the roaming app data store using the "ms-appdata:///roaming/" protocol. For example:

<img src="ms-appdata:///roaming/myFile.png" alt="" />


Use the file APIs, such as Windows.Storage.StorageFolder.CreateFileAsync | createFileAsync and Windows.Storage.FileIO.WriteTextAsync | writeTextAsync, to create and update a file in the roaming app data store. This example creates a file named dataFile.txt in the roamingFolder container and writes the current date and time to the file. The ReplaceExisting | replaceExisting value from the CreationCollisionOption enumeration indicates that the file should be replaced if it already exists.

Next, this example opens the dataFile.txt file created and reads the date from the file using Windows.Storage.FileIO.readTextAsync.

var applicationData = Windows.Storage.ApplicationData.current;
var roamingFolder = applicationData.roamingFolder;

// Write data to a file

function writeTimestamp() {
   roamingFolder.createFileAsync("dataFile.txt", Windows.Storage.CreationCollisionOption.replaceExisting)
      .then(function (sampleFile) {
         var formatter = new Windows.Globalization.DateTimeFormatting.DateTimeFormatter("longtime");
         var timestamp = formatter.format(new Date());

         return Windows.Storage.FileIO.writeTextAsync(sampleFile, timestamp);
      }).done(function () {      

// Read data from a file

function readTimestamp() {
      .then(function (sampleFile) {
         return Windows.Storage.FileIO.readTextAsync(sampleFile);
      }).done(function (timestamp) {
         // Data is contained in timestamp
      }, function () {
         // Timestamp not found

Windows.Storage.StorageFolder roamingFolder = Windows.Storage.ApplicationData.Current.RoamingFolder;

// Write data to a file

async void WriteTimestamp()
   Windows.Globalization.DateTimeFormatting.DateTimeFormatter formatter = 
       new Windows.Globalization.DatetimeFormatting.DateTimeFormatter("longtime");

   StorageFile sampleFile = await roamingFolder.CreateFileAsync("dataFile.txt", 
   await FileIO.WriteTextAsync(sampleFile, formatter.Format(DateTime.Now));

// Read data from a file

async Task ReadTimestamp()
      StorageFile sampleFile = await roamingFolder.GetFileAsync("dataFile.txt");
      String timestamp = await FileIO.ReadTextAsync(sampleFile);
      // Data is contained in timestamp
   catch (Exception)
      // Timestamp not found

Dim roamingFolder As Windows.Storage.StorageFolder = Windows.Storage.ApplicationData.Current.RoamingFolder

' Write data to a file

Private Async Sub WriteTimestamp()
   Dim formatter As DateTimeFormatter = New DateTimeFormatter("longtime")

   Dim sampleFile As StorageFile = Await roamingFolder.CreateFileAsync("dataFile.txt", 
   Await FileIO.WriteTextAsync(sampleFile, formatter.Format(DateTime.Now));
End Sub

' Read data from a file

Private Async Function ReadTimestamp() As Task
      Dim sampleFile As StorageFile = Await roamingFolder.GetFileAsync("dataFile.txt")
      Dim timestamp As string = Await FileIO.ReadTtextAsync(sampleFile)
      ' Data is contained in timestamp
   Catch e1 As Exception
      ' Timestamp not found
   End Try
End Function

StorageFolder^ roamingFolder = ApplicationData::Current->RoamingFolder;

// Write data to a file

void MainPage::WriteTimestamp()
   concurrency::task<StorageFile^> fileOperation = 
       roamingFolder->CreateFileAsync("dataFile.txt", CreateCollisionOption::ReplaceExisting);
   fileOperation.then([this](StorageFile^ sampleFile)
      auto calendar = ref new Calendar;
      auto now = calendar->ToDateTime();
      auto formatter = ref new Windows::Globalization::DateTimeFormatting::DateTimeFormatter("longtime");

      return FileIO::WriteTextAsync(sampleFile, formatter->Format(now));
   }).then([this](task<void> previousOperation) {
      try {
      } catch (Platform::Exception^) {
         // Timestamp not written

// Read data from a file

void MainPage::ReadTimestamp()
   concurrency::task<StorageFile^> getFileOperation(roamingFolder->GetFileAsync("dataFile.txt"));
   getFileOperation.then([this](StorageFile^ file)
      return FileIO::ReadTextAsync(file);
   }).then([this](concurrency::task<String^> previousOperation) {
      String^ timestamp;
      try {
         // Data is contained in timestamp
         timestamp = previousOperation.get();
      } catch (...) {
         // Timestamp not found


Minimum supported client

Windows 8

Minimum supported server

Windows Server 2012

Minimum supported phone

Windows Phone 8.1 [Windows Phone Silverlight 8.1 and Windows Runtime apps]


Windows::Storage [C++]





See also

Quickstart: Roaming application data (JavaScript)
Quickstart: Roaming application data (C#/VB/C++)
Application data overview