/// <summary> /// Run the code example. /// </summary> /// <param name="user">The Dfa user object running the code example. /// </param> public override void Run(DfaUser user) { // Create SubnetworkRemoteService instance. SubnetworkRemoteService service = (SubnetworkRemoteService) user.GetService( DfaService.v1_19.SubnetworkRemoteService); long networkId = long.Parse(_T("INSERT_NETWORK_ID_HERE")); String subnetworkName = _T("INSERT_SUBNETWORK_NAME_HERE"); long permission1 = long.Parse(_T("INSERT_FIRST_PERMISSION_ID_HERE")); long permission2 = long.Parse(_T("INSERT_SECOND_PERMISSION_ID_HERE")); // Create subnetwork structure. Subnetwork subnetwork = new Subnetwork(); subnetwork.id = 0; subnetwork.name = subnetworkName; subnetwork.networkId = networkId; // Create an array of all permissions assigned to this subnetwork and add // it to the subnetwork structure. To get list of available permissions, // run GetAvailablePermissions.cs. subnetwork.availablePermissions = new long[] {permission1, permission2}; try { // Create subnetwork. SubnetworkSaveResult subnetworkSaveResult = service.saveSubnetwork(subnetwork); // Display subnetwork id. Console.WriteLine("Subnetwork with id \"{0}\" was created.", subnetworkSaveResult.id); } catch (Exception ex) { Console.WriteLine("Failed to create subnetwork. Exception says \"{0}\"", ex.Message); } }
public SubnetworkSaveResult saveSubnetwork(Subnetwork subnetwork) { object[] results = this.Invoke("saveSubnetwork", new object[] {subnetwork}); return ((SubnetworkSaveResult) (results[0])); }