How to access UWP application settings set by MDM?

徘徊边缘 提交于 2020-01-04 06:11:24

问题


I am using EnterpriseModernAppManagement CSP to install and set settings for some UWP app as defined here:

https://msdn.microsoft.com/en-us/library/windows/hardware/dn904956(v=vs.85).aspx

.../PackageFamilyName/AppSettingPolicy/SettingValue (only for ./User/Vendor/MSFT) Added in Windows 10, version 1511. The SettingValue and data represent a key value pair to be configured for the app.

UWP app installs correctly and settings setup (via AppSettingPolicy) execute successfully.

But how do I now access those custom settings inside the app itself with c#?

Both Windows.Storage.ApplicationData.Current.LocalSetting.Values and Windows.Storage.ApplicationData.Current.RoamingSettings.Values key/value pairs seem empty and unaffected by MDM changes.

Is there any way to send arbitrary settings/configuration to a custom UWP application via MDM?


回答1:


Apparently, new container is created in app's local settings after AppSettingPolicy key value pairs are pushed via EnterpriseModernAppManagement CSP.

Values can be accessed via:

ApplicationData.Current.LocalSettings.Containers["Managed.App.Settings"].Values

It would be nice if this was documented somewhere! :)



来源:https://stackoverflow.com/questions/40342703/how-to-access-uwp-application-settings-set-by-mdm

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!