Smartsheet.Api.Internal.SheetRowResourcesImpl.CopyRowsToAnotherSheet C# (CSharp) Method

CopyRowsToAnotherSheet() public method

Copies Row(s) from the Sheet specified in the URL to (the bottom of) another sheet.

It mirrors To the following Smartsheet REST API method: POST /sheets/{sheetId}/rows/copy

Up to 5,000 row IDs can be specified in the request, but if the total number of rows in the destination sheet after the copy exceeds the Smartsheet row limit, an error response will be returned.
if any argument is null or empty string if there is any problem with the REST API request if there is any problem with the REST API authorization (access token) if the resource cannot be found if the REST API service is not available (possibly due To rate limiting) if there is any other error during the operation
public CopyRowsToAnotherSheet ( long sheetId, CopyOrMoveRowDirective directive, IEnumerable include, bool ignoreRowsNotFound ) : CopyOrMoveRowResult
sheetId long the sheet Id
directive Smartsheet.Api.Models.CopyOrMoveRowDirective directive
include IEnumerable objects to include
ignoreRowsNotFound bool ignoreRowsNotFound
return Smartsheet.Api.Models.CopyOrMoveRowResult
        public virtual CopyOrMoveRowResult CopyRowsToAnotherSheet(long sheetId, CopyOrMoveRowDirective directive, IEnumerable<CopyRowInclusion> include, bool? ignoreRowsNotFound)
        {
            Utility.Utility.ThrowIfNull(directive);
            IDictionary<string, string> parameters = new Dictionary<string, string>();
            if (include != null)
            {
                parameters.Add("include", QueryUtil.GenerateCommaSeparatedList(include));
            }
            if (ignoreRowsNotFound.HasValue)
            {
                parameters.Add("ignoreRowsNotFound", ignoreRowsNotFound.ToString().ToLower());
            }
            return this.CreateResource<CopyOrMoveRowResult, CopyOrMoveRowDirective>(QueryUtil.GenerateUrl("sheets/" + sheetId + "/rows/copy", parameters), directive);
        }

Usage Example

Ejemplo n.º 1
0
        public virtual void TestCopyRowsToAnotherSheet()
        {
            server.setResponseBody("../../../TestSDK/resources/copyOrMoveRowResult.json");

            CopyOrMoveRowDirective directive = new CopyOrMoveRowDirective()
            {
                RowIds = new List <long> {
                    147258369, 963852741
                }, To = new CopyOrMoveRowDestination()
                {
                    SheetId = 123
                }
            };
            CopyOrMoveRowResult row = sheetRowResource.CopyRowsToAnotherSheet(123, directive, null, true);

            Assert.NotNull(row);
            Assert.AreEqual(row.RowMappings[0].From, 145417762563972);
        }