Search code examples
c#smartsheet-apismartsheet-c#-sdk-v1

Can't use method UpdateRowCellsBuilder from smartsheets


I'm trying to update a cell in smartsheets but it is returning the error -

Error   1   The type name 'UpdateRowCellsBuilder' does not exist in the type 'Tannery_Data.Cell'

The namespace is called Tannery_Data?

I am using these references:

using Smartsheet.Api;
using Smartsheet.Api.Models;
using Smartsheet.Api.OAuth;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

And here is the code

namespace Tannery_Data
{
    class smartsheetQuery
    {
        public Token token;                                          
        String API = "XXXXXXX";                  
        SmartsheetClient smartsheet; 
        long sheetID;
        long workspaceID;

        public smartsheetQuery()
        {
            token = new Token();
            token.AccessToken = API;
            smartsheet = new SmartsheetBuilder().SetAccessToken(token.AccessToken).Build();  /
            sheetID = 1378721379706756;
            workspaceID = 4196096982443908;
        }

        public void updateCell()
        {
            IList<Cell> cells = new Cell.UpdateRowCellsBuilder().AddCell(7735727405459332L, "TESTING").Build();
            smartsheet.Rows().UpdateCells(7602661257176964L, cells);
        }

Absolutely no idea what is going on here?


Solution

  • The error message is stating that it is looking for a Cell class inside the Tannery_Data namespace. There are two ways to resolve this.

    1. Rename the Cell class to something different.

    or

    1. Use the fully qualified name when referencing a class in another namespace. For example instead of using new Cell.UpdateRowCellsBuilder() use new Smartsheet.Api.Models.Cell.UpdateRowCellsBuilder()