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
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
-
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.
Categories
- All Categories
- 14 Welcome to the Community
- Smartsheet Customer Resources
- 64K Get Help
- 410 Global Discussions
- 220 Industry Talk
- 459 Announcements
- 4.8K Ideas & Feature Requests
- 143 Brandfolder
- 137 Just for fun
- 57 Community Job Board
- 459 Show & Tell
- 31 Member Spotlight
- 1 SmartStories
- 298 Events
- 37 Webinars
- 7.3K Forum Archives