The ESim class in the Windows.Networking.NetworkOperators namespace represents an embedded SIM (eSIM, or eUICC) and can be used to manage SIM profiles. Here’s how you can use it to perform the tasks you mentioned:
Discover Profiles: You can use the GetProfilesAsync method of the ESim class to get a list of all eSIM profiles installed on the device. This method returns a list of ESimProfile objects, each representing a profile installed on the eSIM.
Install a Profile: To install a new profile, you can use the DownloadProfileMetadataAsync method of the ESim class. This method downloads the metadata for a new profile from a specified SM-DP+ server. After downloading the metadata, you can use the InstallProfileAsync method to install the profile on the eSIM.
Delete a Profile: To delete an installed profile, you can use the DeleteAsync method of the ESimProfile class. This method deletes the profile from the eSIM.
To get an instance of the ESim class, you can use the FromIdAsync static method of the ESim class. This method returns an ESim object that represents an eSIM with a specified ID.
Please note that these methods are asynchronous and return their results via IAsyncOperation objects. You’ll need to use the await keyword to get their results in an asynchronous method.
Also, please be aware that these methods may not work if you don’t have an actual eSIM installed on your device. You might want to consider getting an eSIM for testing purposes.