I'm using OneDrive service in uwp community toolkit. I can got all folders, but don't know how t get user id(of course not email address, I mean a unique id that represent the user).
Who can help, thanks.
if (await OneDriveService.Instance.LoginAsync())
{
_appFolder = await OneDriveService.Instance.AppRootFolderAsync();
ShowBusy(false);
}
When debuging, I find a user id, located in OneDriveService.Instance ---- Provider ---- AuthenticationProvider ---- CurrentAccountSession ---- UserId, but don't know how to get it
If you check the community toolkit source code, you will find that CurrentAccountSession
is belong to MsaAuthenticationProvider class. And this class is in Microsoft.OneDrive.Sdk.Authentication namespace. If you want to get the UserId
, you would need to change community toolkit's source code and compile a custom version by yourself.
For example, in OneDriveService.cs, you could convert _accountProvider
to MsaAuthenticationProvider
like this (_accountProvider as MsaAuthenticationProvider).CurrentAccountSession.UserId
.