According to the documentation at https://learn.microsoft.com/de-de/microsoft-edge/webview2/reference/win32/webview2-idl?view=webview2-1.0.818.41 the User Data Folder can be set using the following registry entry
[{Root}]\Software\Policies\Microsoft\Edge\WebView2\UserDataFolder
"{AppId}"=""
I don't understand what the AppId is meant to be in this case? Does this mean the setting is specific to a particular app or a different user data folder can be set per registered app?
There is no equivalent to this in the corresponding environment variable, which forces all WebView2 instances on a machine to use a single shared folder:
WEBVIEW2_USER_DATA_FOLDER
Our applications use specific user data folders set via CoreWebView2Environment.CreateAsync, but this gets overwritten if someone else sets the WEBVIEW2_USER_DATA_FOLDER environment variable. It forces all instances to use the shared folder defined in the environment variable.
As our applications depend on having individual folders, we detect if the environment variable is set and show a message or handle it. We would like to do the same if the user folder is set in the registry, but we don't understand how this is done.