79380842

Date: 2025-01-23 11:30:50
Score: 0.5
Natty:
Report link

At last i've managed to make it work in a packaged app using unlocking the feature:

auto result = winrt::Windows::ApplicationModel::LimitedAccessFeatures::TryUnlockFeature(c_lafFeature, c_lafToken, c_lafAttestation);
if (result.Status() == winrt::Windows::ApplicationModel::LimitedAccessFeatureStatus::Available ||
    result.Status() == winrt::Windows::ApplicationModel::LimitedAccessFeatureStatus::AvailableWithoutToken)
{
    auto taskbarManager = winrt::Windows::UI::Shell::TaskbarManager::GetDefault();
    if (taskbarManager.IsSupported() && taskbarManager.IsPinningAllowed() &&
        !taskbarManager.IsCurrentAppPinnedAsync().get())
    {
        taskbarManager.RequestPinCurrentAppAsync().get();
    }                
}
Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: jsubi