Why PackageManager.FindPackagesForUser method not fetching all the store app details

checkingrandom 206 Reputation points
2024-04-05T11:58:43.4033333+00:00

I'm attempting to retrieve details of installed Store apps on the machine using the PackageManager class in C++/WinRT. However, I'm encountering an issue where I only receive a partial result. For example, if there are 20 Store apps installed, only 10 are listed, and the rest are not appearing. Below is the basic code I've used.

#include <windows.h>
#include<winrt/Windows.Management.Deployment.h>
#include<winrt/Windows.ApplicationModel.h>
#include <iostream>

using namespace winrt;
using namespace winrt::Windows::ApplicationModel;
using namespace winrt::Windows::Foundation;
//using namespace winrt::Windows::Foundation;
using namespace winrt::Windows::Management::Deployment;

int main()
{
    init_apartment();

    PackageManager packageManager;
    auto packages = packageManager.FindPackagesForUser(L""); // specified the SID

    for (auto const& package : packages)
    {
        if (!package.IsFramework())
        {
            std::wcout << L"Package Name: " << package.Id().Name().c_str() << std::endl;
            std::wcout << L"Display Name: " << package.DisplayName().c_str() << std::endl;
            std::wcout << L"Publisher: " << package.PublisherDisplayName().c_str() << std::endl;
            std::wcout << L"-------------------------------------------------------------" << std::endl;
            std::wcout << std::endl;
        }
    }

  
    return 0;
}

Windows
Windows
A family of Microsoft operating systems that run across personal computers, tablets, laptops, phones, internet of things devices, self-contained mixed reality headsets, large collaboration screens, and other devices.
5,381 questions
Windows API - Win32
Windows API - Win32
A core set of Windows application programming interfaces (APIs) for desktop and server applications. Previously known as Win32 API.
2,611 questions
C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,720 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.