Search code examples
c#uwpwindows-store

Why does StoreContext.GetStoreProductsAsync(productKinds, storeIDs) get only current UWP app?


I have another UWP question.

I'm trying to get all the UWP apps that I published on the MS Store, but it seems there is something wrong: I can only get the current one beeing executed, although I insert many store IDs, the ones from my apps, as suggested by MS Docs.

Here's the code (of course, in my code I insert the real IDs):

            StoreContext context = StoreContext.GetDefault();

            string[] productKinds = { "Application" };
            List<String> filterList = new List<string>(productKinds);
            string[] storeIds = { "firstID", "secondID", "thirdID" };

            StoreProductQueryResult queryResult = await context.GetStoreProductsAsync(filterList, storeIds);

            if (queryResult.ExtendedError == null)
            {
                foreach (var product in queryResult.Products)
                {
                    // Do something with 'product'
                }
            }

Well, it only returns one item, the current one.

Is there a way to obtain even other store apps? Am I doing something wrong?

Thanks a lot.


Solution

  • GetStoreProductsAsync is only for the products associated with the app (i.e. add-ons):

    Gets Microsoft Store listing info for the specified products that are associated with the current app. [docs]

    To solve the problem you might want to look in the direction of Microsoft Store collection API and purchase API (requires web app setup in Azure).

    Other than that StoreContext class at its current state doesn't contain API to get product information about other apps and their add-ons.