Smartsheet SDK: Cannot find column

Hi,
I have run into a rather annoying issue. I am currently writing a sync tool, which will add a column to a sheet, and write a cell value thereafter.
I am using the smartsheet search feature to find a specific value, and then I add or update a specified column. However, the issue I am running into is that a few of the sheets I am processing do not have the required column, nor am I able to add the column using the smartsheet sdk or via browser/frontend.
Add column logic;
__________________________
Column newLocationColumn = new Column {
ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย Title = "Location Key",
ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย Index = 0,
ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย Type = ColumnType.TEXT_NUMBER
ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย };
IList<Column> addedColumns = client.SheetResources.ColumnResources.AddColumns(
ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย (long)result.ParentObjectId,
ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย new Column[] { newLocationColumn }
ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย ย );
__________________________
Get column logic
___________________________
PaginatedResult<Column> lstColumns = client.SheetResources.ColumnResources.ListColumns((long)result.ParentObjectId, null, new PaginationParameters(true, null, null), 2);
__________________________
If I try and add the column 'Location Key', I get the below error messages.
Regards,
Kevin
Answers
-
Well, after testing the unobvious.. I added a .ToLower() on my column name check.
____
long colUpdateId = lstColumns.Data.Where(x => x.Title.ToLower() == "ColumnName".ToLower()).Select(x => x.Id).FirstOrDefault() ?? 0;
____
This is probably due to typo's..