The User Data Folder (UDF) is a directory on your machine that stores data related to your WebView2 applications, including browser data like bookmarks, cookies, and cached resources. To find the location of the User Data Folder, you can use the CoreWebView2Environment.UserDataFolder property in your code after creating the WebView2 environment. This property returns the path to the UDF for the current session.
Here’s an example of how to retrieve the UDF location in C#:
private void OnGetUDFClick(object sender, RoutedEventArgs e)
{
// This property can be used after WebView2 creation to find the actual location of the User Data Folder
UserDataFolder.Text = WebView2.CoreWebView2.Environment.UserDataFolder;
}
If you are using Win32, you can access it using the ICoreWebView2Environment7.get_UserDataFolder property getter:
auto environment7 = m_webViewEnvironment.try_query<ICoreWebView2Environment7>();
CHECK_FEATURE_RETURN(environment7);
wil::unique_cotaskmem_string userDataFolder;
environment7->get_UserDataFolder(&userDataFolder);
Once you have the path to the User Data Folder, you can navigate to that location on your file system to look for your deleted bookmarks, assuming they are stored there. However, if the bookmarks were deleted, you may need to check for backup files or other recovery options, as simply accessing the UDF may not restore them directly.
References: