Posted on 09-14-2015 08:33 AM
I'm currently trying to update Mobile Device Configuration
Profiles' exclusions scope
In order to do this, the following steps are being taken:
After these actions I get a Http 409 status code returned :
Note: The code examples below have been modified for easy reading. so for example, exception handling is not included.
Example C# Code
//Service Declaration
JSSApi.MdmInterfaceClient AppleApi = new JSSApi.MdmInterfaceClient();
//Read the Profile - Scroll down to see response
var XmlProfileResponse = AppleApi.ReadMobileConfigurationProfile(mConfig.Id.ToString(), inXML:true);
XElement XmlDocX = XElement.Parse(XmlProfileResponse);
XmlDocX.Element("scope").Element("exclusions").Element("mobile_devices")
.Add(new XElement("mobile_device",
new XElement("id", "#MyMobileDeviceID#"),
new XElement("name", "#MyMobileDeviceName#"),
new XElement("udid", "#MyMobileDeviceUDID#")));
AppleApi.UpdateMobileConfigurationProfile(mConfig.Id.ToString(), XmlDocX.ToString());
XmlProfileResponse
<configuration_profile>
<general>
<id>1</id>
<name>NoCamera</name>
<description/>
<site>
<id>-1</id>
<name>None</name>
</site>
<category>
<id>-1</id>
<name>No category assigned</name>
</category>
<uuid>E49F0270-85A7-440C-A719-D7B98CEC0D7D</uuid>
<deployment_method>Install Automatically</deployment_method>
<redeploy_on_update>Newly Assigned</redeploy_on_update>
<redeploy_days_before_certificate_expires>0</redeploy_days_before_certificate_expires>
<payloads><?xml version="1.0" encoding="UTF-8"?><!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1"><dict><key>PayloadUUID</key><string>E49F0270-85A7-440C-A719-D7B98CEC0D7D</string><key>PayloadType</key><string>Configuration</string><key>PayloadOrganization</key><string>Actacom Demo</string><key>PayloadIdentifier</key><string>E49F0270-85A7-440C-A719-D7B98CEC0D7D</string><key>PayloadDisplayName</key><string>NoCamera</string><key>PayloadDescription</key><string/><key>PayloadVersion</key><integer>1</integer><key>PayloadEnabled</key><true/><key>PayloadRemovalDisallowed</key><true/><key>PayloadContent</key><array><dict><key>PayloadUUID</key><string>790126EB-5B0F-4943-B92C-2FDBDE8948E1</string><key>PayloadType</key><string>com.apple.applicationaccess</string><key>PayloadOrganization</key><string>Actacom Demo</string><key>PayloadIdentifier</key><string>790126EB-5B0F-4943-B92C-2FDBDE8948E1</string><key>PayloadDisplayName</key><string>com.apple.applicationaccess</string><key>PayloadDescription</key><string/><key>PayloadVersion</key><integer>1</integer><key>PayloadEnabled</key><true/><key>ratingRegion</key><string>us</string><key>ratingTVShows</key><integer>1000</integer><key>ratingMovies</key><integer>1000</integer><key>ratingApps</key><integer>1000</integer><key>safariAllowJavaScript</key><true/><key>safariAllowAutoFill</key><true/><key>safariForceFraudWarning</key><false/><key>safariAllowPopups</key><true/><key>safariAcceptCookies</key><integer>2</integer><key>allowDiagnosticSubmission</key><true/><key>forceEncryptedBackup</key><false/><key>allowVoiceDialing</key><true/><key>allowVideoConferencing</key><true/><key>allowInAppPurchases</key><true/><key>allowGlobalBackgroundFetchWhenRoaming</key><true/><key>allowSafari</key><true/><key>allowiTunes</key><true/><key>allowYouTube</key><true/><key>allowScreenShot</key><true/><key>allowExplicitContent</key><true/><key>allowCamera</key><false/><key>allowAppInstallation</key><true/><key>allowAppRemoval</key><true/><key>allowAssistant</key><true/><key>allowGameCenter</key><true/><key>allowMultiplayerGaming</key><true/><key>allowAddingGameCenterFriends</key><true/><key>forceITunesStorePasswordEntry</key><false/><key>allowUntrustedTLSPrompt</key><true/><key>allowCloudBackup</key><true/><key>allowCloudDocumentSync</key><true/><key>allowPhotoStream</key><true/><key>allowAssistantWhileLocked</key><true/><key>forceAssistantProfanityFilter</key><false/><key>allowSharedStream</key><true/><key>allowPassbookWhileLocked</key><true/><key>allowUIConfigurationProfileInstallation</key><true/><key>allowBookstore</key><true/><key>allowBookstoreErotica</key><true/><key>allowChat</key><true/><key>allowCloudKeychainSync</key><true/><key>allowAccountModification</key><true/><key>allowFindMyFriendsModification</key><true/><key>allowOpenFromManagedToUnmanaged</key><true/><key>allowOpenFromUnmanagedToManaged</key><true/><key>allowLockScreenControlCenter</key><true/><key>allowLockScreenControlCenter</key><true/><key>allowLockScreenNotificationsView</key><true/><key>allowLockScreenTodayView</key><true/><key>allowAssistantUserGeneratedContent</key><true/><key>allowAirDrop</key><true/><key>allowAppCellularDataModification</key><true/><key>allowFingerprintForUnlock</key><true/><key>allowOTAPKIUpdates</key><true/><key>allowHostPairing</key><true/><key>forceAirPlayOutgoingRequestsPairingPassword</key><false/><key>forceAirPlayIncomingRequestsPairingPassword</key><false/><key>forceLimitAdTracking</key><false/><key>allowManagedAppsCloudSync</key><true/><key>allowEraseContentAndSettings</key><true/><key>allowSpotlightInternetResults</key><true/><key>allowEnablingRestrictions</key><true/><key>allowActivityContinuation</key><true/><key>allowEnterpriseBookBackup</key><true/><key>allowEnterpriseBookMetadataSync</key><true/><key>allowPodcasts</key><true/><key>allowPredictiveKeyboard</key><true/><key>allowAutoCorrection</key><true/><key>allowSpellCheck</key><true/><key>allowDefinitionLookup</key><true/></dict></array></dict></plist></payloads>
</general>
<scope>
<all_mobile_devices>false</all_mobile_devices>
<mobile_devices/>
<mobile_device_groups>
<mobile_device_group>
<id>5</id>
<name>DevGroup01</name>
</mobile_device_group>
</mobile_device_groups>
<buildings/>
<departments/>
<limitations>
<users/>
<user_groups/>
<network_segments/>
<ibeacons/>
</limitations>
<exclusions>
<mobile_devices/>
<mobile_device_groups/>
<buildings/>
<departments/>
<users/>
<user_groups/>
<network_segments/>
<ibeacons/>
</exclusions>
</scope>
<self_service>
<self_service_description/>
<security>
<removal_disallowed>Never</removal_disallowed>
</security>
<self_service_icon/>
<feature_on_main_page>false</feature_on_main_page>
<self_service_categories/>
</self_service>
</configuration_profile>
Solved! Go to Solution.
Posted on 09-14-2015 09:35 AM
Hi @actademo ,
Could you get the response text for the 409 error and share it? The message should contain more specific details about what is causing the conflict.
Also, if the only thing you need to modify on the profile is the exclusions you should be able to just PUT the XML for that and not the entire doc. Kind of like this:
<configuration_profile>
<scope>
<exclusions>
<mobile_devices>(mobile_device XML here)</mobile_devices>
</exclusions>
</scope>
</configuration_profile>
Posted on 09-14-2015 09:35 AM
Hi @actademo ,
Could you get the response text for the 409 error and share it? The message should contain more specific details about what is causing the conflict.
Also, if the only thing you need to modify on the profile is the exclusions you should be able to just PUT the XML for that and not the entire doc. Kind of like this:
<configuration_profile>
<scope>
<exclusions>
<mobile_devices>(mobile_device XML here)</mobile_devices>
</exclusions>
</scope>
</configuration_profile>
Posted on 09-15-2015 01:26 AM
Hello Tyrell,
I tried to update the profile with the following XML as body for the PUT Request:
<configuration_profile>
<scope>
<exclusions>
<mobile_devices>
<mobile_device>
<id>4</id>
<name>Alexander’s iPad</name>
<udid>fc7f1d1fe84845bf######8ec07b7ce30a6f98ac</udid>
</mobile_device>
</mobile_devices>
</exclusions>
</scope>
</configuration_profile>
Still getting error 409 (Conflict).
Details:
Conflict:
Error: MobileDevice (ID:4, Name:Alexander’s iPad) is enabled for a site.
I suppose the problem occurs when I want to add a device to a profile which does not exist within that site?
Posted on 09-15-2015 05:03 AM
When removing the Device from the site it did work.
Posted on 09-15-2015 10:12 AM
@actademo you're probably on the right track. If the profile is assigned to a site and the device you're excluding is not in the same site you would run into this issue. If the profile global or limited to a site?
Posted on 09-16-2015 03:46 AM
@brysontyrrell The problem is solved by putting the device in the same site as the profile was assigned to. Thanks for the support