Reputation: 421
We have Windows 10 application and we are trying to change time zone on the system.
I have found documentation about having IOT extensions included into the project, what would give basic system administration capabilities.
https://msdn.microsoft.com/en-us/windows/uwp/packaging/app-capability-declarations
So far, I failed to get permission to do anything (reboot system, change time zone etc), always get auth exception.
This is what I have tried:
manifest (important parts):
<Package
xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest"
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
xmlns:iot="http://schemas.microsoft.com/appx/manifest/iot/windows10"
IgnorableNamespaces="uap mp iot">
<Dependencies>
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.10586.0" MaxVersionTested="10.0.10586.0" />
<TargetDeviceFamily Name="Windows.IoT" MinVersion="10.0.10586.0" MaxVersionTested="10.0.10586.0" />
</Dependencies>
<Capabilities>
<iot:Capability Name="systemManagement" />
</Capabilities>
</Package>
code:
Boolean canChange = Windows.System.TimeZoneSettings.CanChangeTimeZone;
Windows.System.TimeZoneSettings.ChangeTimeZoneByDisplayName("(UTC+13:00) Samoa");
reference to IOT added to project
Upvotes: 1
Views: 1622
Reputation: 13
Old threat but when i search for my solution to this IoT systemManagement manifest i stumble into this. I using VS2017. My fix is View code package manifest manually. Then add this line
<Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest"
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
xmlns:uap4="http://schemas.microsoft.com/appx/manifest/uap/windows10/4"
xmlns:iot="http://schemas.microsoft.com/appx/manifest/iot/windows10" IgnorableNamespaces="uap mp uap4 iot">
<Capabilities>
<iot:Capability Name="systemManagement"/>
<Capabilities>
*Remember you can only declare 1 Capabilites so if you had declare just add new.
Then add capability in manifest with this code
And plus go to add reference->Extension select Windows IoT Extensions for the UWP version 10.0.10586.0 *even you have newer version must select this to work.
Upvotes: 1
Reputation: 421
IOT: as Jackie said: "Not sure it'll work out. But the point is IoT extension are only meant for windows IoT devices"
However, I did find a workaround...
If anyone else encounters this problem.
I have run a local lightweight NancyFX web service that has an access to system settings. From an UWP application, I will make api calls and change system settings this way.
see http://nancyfx.org/ and self hosting example
Also, if calling localhost from edge, you will need to setup a loopback app exception, see https://loopback.codeplex.com/ and https://msdn.microsoft.com/en-us/library/windows/apps/hh780593.aspx
Pretty much everything works after that.
Upvotes: 1