Posted on 09-14-2015 06:44 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>