Share via

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

checkingrandom 226 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 development | Windows API - Win32
Windows for business | Windows Client for IT Pros | User experience | Other
Developer technologies | C++
Developer technologies | 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.


Your answer

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