0

I am trying to retrieve data from my smartsheet using SmartsheetClient. But when I try to access comments against a row, the comments are null. Following is my code:

string accessToken = "accesstokenvalue";
long sheetId = 121212221;
SmartsheetClient smartSheetClient = new SmartsheetBuilder().SetAccessToken(accessToken).Build();
IEnumerable<SheetLevelInclusion> inclusion = new SheetLevelInclusion[] { SheetLevelInclusion.ATTACHMENTS, SheetLevelInclusion.COLUMN_TYPE, SheetLevelInclusion.OBJECT_VALUE, SheetLevelInclusion.ROW_WRITER_INFO, SheetLevelInclusion.CONTACT_REFERENCES, SheetLevelInclusion.CROSS_SHEET_REFERENCES, SheetLevelInclusion.DISCUSSIONS, SheetLevelInclusion.FILTERS, SheetLevelInclusion.FILTER_DEFINITIONS, SheetLevelInclusion.FORMAT, SheetLevelInclusion.OWNER_INFO, SheetLevelInclusion.ROW_PERMALINK, SheetLevelInclusion.ROW_WRITER_INFO, SheetLevelInclusion.SOURCE };
Sheet sheet = smartSheetClient.SheetResources.GetSheet(sheetId, inclusion, null, null, null, null, null, null);

Reference Image:

enter image description here

Thanks

ArslanIqbal
  • 569
  • 1
  • 6
  • 19

1 Answers1

2

I could be wrong but I believe you'll have to list discussions on the row for that:

PaginatedResult<Discussion> discussions = smartsheet.SheetResources.RowResources.DiscussionResources.ListDiscussions(sheetId, sheet1.Rows[0].Id.Value, new DiscussionInclusion[] { DiscussionInclusion.COMMENTS }, null);

timwells
  • 341
  • 1
  • 4
  • 1
    The above from timwells is correct. When making a GET SHEET request and including the Discussions on the sheet only the top level Discussions are returned. To get the Comments on each of the Discussions you would need to do additional requests to List the Discussions on the Sheet: https://smartsheet-platform.github.io/api-docs/?csharp#list-discussions – daveskull81 Apr 09 '19 at 20:00
  • Actually I was trying to avoid another network call for comments retrieval but I think there isn't a way to avoid this. Thank you for your help. – ArslanIqbal Apr 10 '19 at 05:54