question

JassimAlRahma-9056 avatar image
0 Votes"
JassimAlRahma-9056 asked LeonLu-MSFT edited

Clear SecureStorage except one!

Hi,

How can I clear all SecureStorage except one which is named Country

 SecureStorage.GetAsync("Country")


Thanks,
Jassim


dotnet-csharpdotnet-xamarin
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

LeonLu-MSFT avatar image
0 Votes"
LeonLu-MSFT answered LeonLu-MSFT edited

Hello,​

Welcome to our Microsoft Q&A platform!

How can I clear all SecureStorage except one which is named Country

1.You can call the SecureStorage.GetAsync("Country") to save the value in your application.

2.Then call SecureStorage.RemoveAll(); to remove the all keys.

  1. Set the Courntry key await SecureStorage.SetAsync("Country", "xxxxxxx");, Now your achieve the Clear SecureStorage except Country key.

Best Regards,

Leon Lu



If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


· 4
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

There is no way to loop and check?

0 Votes 0 ·

Yes,it do not provide any loop to get the all of the SecureStorage, you can see this thread(Just have four Apis): https://docs.microsoft.com/en-us/dotnet/api/xamarin.essentials.securestorage?view=xamarin-essentials

1 Vote 1 ·

@JassimAlRahma-9056 You could make a feature request in xamarin.Essential github.https://github.com/xamarin/Essentials/issues/new/choose

1 Vote 1 ·

@JassimAlRahma-9056 May I know if you have got any chance to check my answer? I am glad to help if you have any other questions

0 Votes 0 ·