WinUI 3 / MSIX app creates new OneDrive AppFolder (“My App 1”) instead of using existing (“My App”)
I’ve migrated my UWP app to WinUI 3 with MSIX packaging, and also updated Microsoft Graph SDK from 4.x to 5.x. The original UWP app uses OneDrive’s special.AppFolder to store user data, which created a folder named "My App".
However, after migrating, the new WinUI 3 app is creating a new folder called "My App 1", even though:
• The same Azure AD app registration and Client ID is used
• The app is correctly packaged with MSIX
• The correct redirect URI is used:
ms-appx-web://microsoft.aad.brokerplugin/<ClientId>
• Token cache is cleared, sign-in is interactive and fresh
I create the client app instance as follows:
var options = new BrokerOptions(BrokerOptions.OperatingSystems.Windows);
var clientApp = PublicClientApplicationBuilder.Create(_clientId)
.WithRedirectUri($"ms-appx-web://microsoft.aad.brokerplugin/{_clientId}")
.WithParentActivityOrWindow(() => hwnd)
.WithBroker(options)
.Build();
I have also tried with other redirect uris including:
- .WithDefaultRedirectUri()
- msal<ClientId>://auth
GraphServiceClient.Drives[drive.Id].Special["approot"] always returns the "My App 1" folder.
I need the migrated app to access the original "My App" folder to preserve user data. Can someone clarify:
• What causes OneDrive to associate a new AppFolder despite same Client ID?
• How can I ensure app upgrade does not break access to "My App"?
Appreciate any insight or escalation.