Writing to Windows Document Folder


I have an application that runs on Windows and Mac. It keeps it’s data files in the Documents folder on both platforms which are set up when first starting the application (SpecialFolder.Documents).

I am not a Windows expert having spent most of my time on Mac, but up to now I have not experienced a problem on Windows machines running 7,8 10. On my test machines there has never been a problem.

On this particular customer’s machine (which is running Windows 7 Pro) the application cannot write to the documents folder and create the data folders and files. On this machine I note it is named ‘MyDocuments’ but \Users\UserName\Documents\ seems to exist. All permissions etc seem to be correct.

Can anyone shed any light on this?


Don’t use the Documents folder for your app data. Use instead

Many thanks for the advice.

Windows can be a tricky beast with all of the fine grained admin permissions that can be applied.

Are you checking the IsWritable flag first?

Yes, I checked that. Thank you.

I do use the ApplicationData folder for other purposes within the application and I know it writes to that successfully, so for me that provides a simple solution if it provides more reliability across machines. The only downside is that occasionally it is hidden on customers machines and they have problems accessing it should the need arise.

Keep in mind that in certain corporate environments, the user folders can actually physically exist on a network drive. It could be that SpecialFolder.Documents is not where you expect it to be.

For instance, if you are expecting to be able to do a Move operation, it may outright fail if the source is on the physical drive, but documents is on a server somewhere.

Thank you for pointing that out. Good point.

That is pretty much the point as well. You may not want users to mess up with configuration files.

What you can do is to create a public folder in there, which you open for the user with a folderItem.Launch.