private void CreateServiceApplicationProxy(OceanikServiceApplication serviceApp) { // get reference to the installed service proxy OceanikServiceProxy serviceProxy = SPFarm.Local.ServiceProxies.GetValue <OceanikServiceProxy>(); // create service app proxy OceanikServiceApplicationProxy serviceAppProxy = new OceanikServiceApplicationProxy( ServiceAppName.Text + " Proxy", serviceProxy, serviceApp.Uri); serviceAppProxy.Update(true); // provision service app proxy serviceAppProxy.Provision(); // start it if it isn't already started if (serviceAppProxy.Status != SPObjectStatus.Online) { serviceAppProxy.Status = SPObjectStatus.Online; } serviceAppProxy.Update(true); // add the proxy to the default group if selected if (DefaultServiceApp.Checked) { SPServiceApplicationProxyGroup defaultGroup = SPServiceApplicationProxyGroup.Default; defaultGroup.Add(serviceAppProxy); defaultGroup.Update(true); } }
public override void FeatureActivated(SPFeatureReceiverProperties properties) { // install the service var service = SPFarm.Local.Services.GetValue <OceanikService>(); if (service == null) { service = new OceanikService(SPFarm.Local); service.Update(); } // install the service proxy var serviceProxy = SPFarm.Local.ServiceProxies.GetValue <OceanikServiceProxy>(); if (serviceProxy == null) { serviceProxy = new OceanikServiceProxy(SPFarm.Local); serviceProxy.Update(true); } // with service added to the farm, install instance var serviceInstance = new OceanikServiceInstance(SPServer.Local, service); serviceInstance.Update(true); }