Anguilla does not provide any methods (webservice or JavaScript) for a general change to ApplicationData. You will need to specify your own server code in order to install ApplicationData.
So, in my last need for this, I wrote a simple WCF web service that installs application data:
[ServiceBehavior(InstanceContextMode = InstanceContextMode.Single, ConcurrencyMode = ConcurrencyMode.Multiple)] [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Required)] [ServiceContract(Namespace= "ExtensionsModel.Services")] public class ExtensionsService { [OperationContract] [WebInvoke(Method = "POST", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)] public void SetEnabled(string[] itemIDs, bool enabled) { using (var client = TridionCoreService.GetSessionAwareClient()) { var appdata = new ApplicationData(); appdata.ApplicationId = "ext:IsEnabled"; appdata.Data = new ASCIIEncoding().GetBytes(enabled ? bool.TrueString : bool.FalseString); foreach (var itemID in itemIDs) { client.SaveApplicationData(itemID, new[] {appdata}); } } } }
Connected it in the configuration file of my model:
<?xml version="1.0" encoding="utf-8" ?> <Configuration> <resources cache="true"> <cfg:filters/> <cfg:groups> <cfg:group name="Extensions.Models"> <cfg:domainmodel name="Extensions.Models"> <cfg:services> <cfg:service type="wcf">Services/ExtensionsService.svc</cfg:service> </cfg:services> </cfg:domainmodel> </cfg:group> </cfg:groups> ...
Then call this web method from my command._execute
Extensions.Commands.DisableExtension.prototype._execute = function (selection) { ExtensionsModel.Services.ExtensionsService.SetEnabled(selection.getItems(), false); };
Frank van puffelen
source share