Is there a specific folder to save to when you want to persist data?

430
1
Jump to solution
12-21-2018 02:08 PM
KylePerri
Esri Contributor

I am making an add-in that allows the user to add configurations which have properties like name, url, etc. I am trying to save the configurations out to a json file and I need that data to be accessed by an html file. I tried using the custom settings in the Module with OnReadSettingsAsync and OnWriteSettingsAsync, but I don't know how I would be able to link that in my HTML file. So I wanted to know if there is a specific folder to write files to for persisting data. It should also be noted that I want the data to persist in every project and not be specific to each project.

0 Kudos
1 Solution

Accepted Solutions
Wolf
by Esri Regular Contributor
Esri Regular Contributor

Hi Kyle,

 I would recommend to write any data you want to persist across projects to this folder:

var settingsPath = System.IO.Path.Combine (Environment.GetFolderPath(System.Environment.SpecialFolder.CommonDocuments),
        "ArcGIS", "ArcGISPro", "Settings");

ArcGIS Pro is already using the "ArcGIS\ArcGISPro" folder in the common documents folder across projects. You can read/write your settings from/to a file in that common location.  I am not sure about you html file question. I don't think you can read a json file from within an html file that is stored on your local disk, I am pretty sure this results in some type of access exception.  However, you could write your configuration in form of html so that it is human readable and parse the file in order to get your configuration settings. 

View solution in original post

0 Kudos
1 Reply
Wolf
by Esri Regular Contributor
Esri Regular Contributor

Hi Kyle,

 I would recommend to write any data you want to persist across projects to this folder:

var settingsPath = System.IO.Path.Combine (Environment.GetFolderPath(System.Environment.SpecialFolder.CommonDocuments),
        "ArcGIS", "ArcGISPro", "Settings");

ArcGIS Pro is already using the "ArcGIS\ArcGISPro" folder in the common documents folder across projects. You can read/write your settings from/to a file in that common location.  I am not sure about you html file question. I don't think you can read a json file from within an html file that is stored on your local disk, I am pretty sure this results in some type of access exception.  However, you could write your configuration in form of html so that it is human readable and parse the file in order to get your configuration settings. 

0 Kudos