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
- Customer Resources
- 64.9K Get Help
- 441 Global Discussions
- 140 Industry Talk
- 472 Announcements
- 4.9K Ideas & Feature Requests
- 129 Brandfolder
- 148 Just for fun
- 68 Community Job Board
- 496 Show & Tell
- 33 Member Spotlight
- 2 SmartStories
- 300 Events
- 36 Webinars
- 7.3K Forum Archives