Welcome to the Smartsheet Forum Archives


The posts in this forum are no longer monitored for accuracy and their content may no longer be current. If there's a discussion here that interests you and you'd like to find (or create) a more current version, please Visit the Current Forums.

ColumnId's return null

Options
hakanozp
hakanozp
edited 12/09/19 in Archived 2016 Posts

Hi,

 

I' m trying to get column id values for a sheet but values return null. I' ve tried following methods.

 

Token token = new Token();

token.AccessToken = MY_TOKEN;

long sheetId = MY_SHEETID;

long columnId;

 

SmartsheetClient sc = new SmartsheetBuilder().SetAccessToken(token.AccessToken).Build();

 

//Method I                

Sheet sh = sc.SheetResources.GetSheet(sheetId, null, null, null, null, null, null, null);

columnId = sh.Columns[0].Id.Value;

 

//Method II

PaginatedResult<Column> columnsResult = sc.SheetResources.ColumnResources.ListColumns(sheetId, null, null);

columnId = columnsResult.Data[0].Id.Value;

 

 

sh.Columns[0] gives the properties below, there' s no id in it.

 

{Smartsheet.Api.Models.Column}

    base {Smartsheet.Api.Models.IdentifiableModel}: {Smartsheet.Api.Models.Column}

    AutoNumberFormat: null

    Filter: null

    Format: null

    Hidden: null

    Index: null

    Locked: null

    LockedForUser: null

    Options: null

    Primary: true

    SheetId: null

    Symbol: null

    SystemColumnType: null

    Tags: null

    Title: "Task Name"

    Type: TEXT_NUMBER

 

    Width: 100

Comments

  • Jenny Lam
    Options

    Hi hakanozp,

     

    Please add SheetInclusion.COLUMN_TYPE when calling SheetResources.GetSheet:

     

    Sheet sh = sc.SheetResources.GetSheet(sheetId, EnumSet.of(SheetInclusion.COLUMN_TYPE),null, null, null, null, null, null);

    List<Column> columns = sh.getColumns();

     

    I am able to get the columns details including column Ids this way.

This discussion has been closed.