private static void CopyRowToCreatedSheet(SmartsheetClient smartsheet, long sheetId, long rowId) { long tempSheetId = smartsheet.SheetResources.CreateSheet(new Sheet.CreateSheetBuilder("tempSheet", new Column[] { new Column.CreateSheetColumnBuilder("col1", true, ColumnType.TEXT_NUMBER).Build() }).Build()).Id.Value; CopyOrMoveRowDestination destination = new CopyOrMoveRowDestination { SheetId = tempSheetId }; CopyOrMoveRowDirective directive = new CopyOrMoveRowDirective { RowIds = new long[] { rowId }, To = destination }; CopyOrMoveRowResult result = smartsheet.SheetResources.RowResources.CopyRowsToAnotherSheet(sheetId, directive, new CopyRowInclusion[] { CopyRowInclusion.CHILDREN }, false); }
public virtual void TestMoveRowsToAnotherSheet() { server.setResponseBody("../../../TestSDK/resources/copyOrMoveRowResult.json"); CopyOrMoveRowDirective directive = new CopyOrMoveRowDirective() { RowIds = new List <long> { 147258369, 963852741 }, To = new CopyOrMoveRowDestination() { SheetId = 123 } }; CopyOrMoveRowResult row = sheetRowResource.MoveRowsToAnotherSheet(123, directive, null, true); Assert.NotNull(row); Assert.AreEqual(row.RowMappings[1].To, 2256565987239812); }
public void CopyRow_AnotherSheet() { SmartsheetClient ss = HelperFunctions.SetupClient("Copy row to another sheet"); CopyOrMoveRowResult result = ss.SheetResources.RowResources.CopyRowsToAnotherSheet( 1228520367122308, new CopyOrMoveRowDirective { RowIds = new List <long> { 2891150423025540 }, To = new CopyOrMoveRowDestination { SheetId = 799249123305348 } }, null, null); Assert.AreEqual(result.DestinationSheetId, 799249123305348); }
/// <summary> /// De-serialize a CopyOrMoveRowResult object from JSON. /// /// Parameters: /// - inputStream : the input stream from which the JSON will be read /// /// Returns: the de-serialized CopyOrMoveRowResult /// /// Exceptions: - IllegalArgumentException : if any argument is null - JSONSerializationException : if there is any /// other error occurred during the operation /// </summary> /// <param name="inputStream"> the input stream </param> /// <returns> the CopyOrMoveRowResult </returns> /// <exception cref="JsonSerializationException"> the JSON serializer exception </exception> public virtual CopyOrMoveRowResult DeserializeRowResult(StreamReader inputStream) { Utils.ThrowIfNull(inputStream); CopyOrMoveRowResult result = null; try { result = serializer.Deserialize <CopyOrMoveRowResult>(new Newtonsoft.Json.JsonTextReader(inputStream)); } catch (Newtonsoft.Json.JsonException ex) { throw new JsonSerializationException(ex); } catch (IOException ex) { throw new JsonSerializationException(ex); } return(result); }