2

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?

Looka
  • 51
  • 5
  • How were you able to install the app from MDM? I created a sample app from Visual Studio and signed it, hosted it on local https server. Was trying to install appxbundle. I'm getting success for installation but however the status shows installing. It doesn't change at all. I have turned on sideloading and also added MIME type of application-octetstream for appxbundle – Aster Veigas Dec 08 '16 at 20:37
  • Hm, and sideloading of the same works ok? There was this issue with IIS so I had to use nginx instead before fixing IIS.You need to make sure that on HEAD http request made by WP server returns correct Content-Length header, and not zero. Also, make sure that servers obeys Range request header correctly, WP will first ask for just first byte (0-0). Also also, I think Cache-Control needs to be none. Either way, try using different http server and use Fiddler to make sure all request are made. Since requests are chunked, there should be 5-10 total requests visible for single app. – Looka Dec 11 '16 at 19:10
  • Sideloading of the appxbundle works when installed manually on the device. – Aster Veigas Dec 12 '16 at 04:49
  • Then it's surely just http server capability / headers issues I mentioned. – Looka Dec 12 '16 at 09:35
  • When the Managed.App.Settings changes, is there any event fired? Can we configure apps which are not installed using the MDM? I personally feel its not possible. Have you tried this by any chance? – Aster Veigas Dec 12 '16 at 10:15
  • ApplicationData.DataChanged should be fired. Any app can be "configured" as long as app actually reads and understands the settings (and it's signature is trusted). I think. :) – Looka Dec 12 '16 at 12:41
  • I tried the ApplicationData.DataChanged event and did not work. However the data was pushed to the app but my app did not get notified. May be I need to spin a thread to read from the container. Any thoughts? – Aster Veigas Dec 27 '16 at 21:25

1 Answers1

3

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! :)

Looka
  • 51
  • 5