How can I create a simple text file on a windows phone (8.1) that can be accessed trough USB cable?

761 views Asked by At

So as title states, I would like to create a simple text file, that I could write to from my C# application, and copy it to my PC trough an USB cable.

Just to be clear, I would like to write a file to this place, because I can access this from my PC. enter image description here

2

There are 2 answers

1
Igor Kulman On BEST ANSWER

There is a capability for writing to the Documents folder on the phone, but adding it to your manifest would cause your app to fail the certification process in the Windows Phone Store.

The capability is called documentsLibrary

<Capability Name="documentsLibrary" />

If you declare it, you can then read and write files in KnownFolders.DocumentsLibrary.

1
Joehl On

You have access to the public - documents folder from the windwsphone. Look at the following code-snippet (details: https://stackoverflow.com/a/15625701/2653134)

var folder = ApplicationData.Current.LocalFolder;
    var file = await folder.CreateFileAsync(fileName, CreationCollisionOption.ReplaceExisting);