C# API access to row attachments

kj2757
kj2757
edited 04/18/24 in API & Developers

Greetings,

I have been able to use the Smartsheet C# API to access sheet and cell data without issues. I added an attachment to a row and attempted to get information about it via the API:

// Load the entire sheet

Sheet sheet = smartsheet.SheetResources.GetSheet(selectedSheetID, null, null, null, null, null, null, null);

// Build column map for later reference

foreach (Column column in sheet.Columns)

  columnMap.Add(column.Title, (long)column.Id);


// Find and store all attachment metadata in custom AttachmentData class objects 

List<AttachmentData> allAttachments = new List<AttachmentData>();

foreach (Row row in sheet.Rows) {

  foreach (Attachment curAttachment in row.Attachments) {


Sheet.Attachments is null and when going into a specific row, the row.Attachments is also null. I refreshed the sheet and it shows the attachment and the row cell data is correctly pulled by the API. I also note that row.ModifiedAt is set to yesterday despite my having just aded the attachment within the hour.

I'm just wondering whether I am going about this the wrong way or whether there is a way to specify programatically to get the latest version of the sheet. I know GetSheet() has an ifVersionAfter parameter but does it need to be explicitly set?   


Any guidance is appreciated - thanks.

Answers