How to move multiple rows to another sheet via API

michael_hostetler85551 ✭✭✭✭✭✭
edited 12/09/19 in API & Developers

I have code in C# that moves a row from one sheet to another, but I can only get it to work when I hard code the row id in the CopyOrMoveRowDirective line.  What is the syntax for passing a row id into the statement?  I have tried rowm.ID in place of 80233296095108, but i get a syntax error.  Here is a simplified version of the code, but need to pass in the current rowid as I loop through.

foreach (Row rowm in sheet.Rows)



              CopyOrMoveRowDestination destination = new CopyOrMoveRowDestination { SheetId = 336102784558980 };

              CopyOrMoveRowDirective directive = new CopyOrMoveRowDirective { RowIds = new long[] { 80233296095108 }, To = destination };

              CopyOrMoveRowResult results = smartsheet.SheetResources.RowResources.MoveRowsToAnotherSheet(3267158118557572, directive, null, null);