Error 1012: 'Required object attribute(s) are missing from your request: values.'

I'm having difficulties with the AddRows method in Smartsheet's C# SDK. I have been getting the error code 1012 with the message 'Required object attribute(s) are missing from your request: values." I have seen others post similar issues but with 'cell.value' as the missing attribute. In my case, what is 'values' supposed to represent?

Best Answer

Answers

  • Genevieve P.
    Genevieve P. Employee Admin

    Hi Joe,

    Would it be possible to see your request? (Deleting any of the sensitive data).

    Here's the API Documentation on how to AddRows: https://smartsheet-platform.github.io/api-docs/?csharp#add-rows

    There's an example of what it might look like in C# on the right, and an example of what's required listed:

     Cells:  -- if specified, must be an array of Cell Objects (see here) , with the following attributes:

    • columnId (required)
    • One of the following (required):
    • formula - or -
    • value

    Could you be missing the "Value" portion from the list above?

  • Hi Genevieve, I'll copy my code in the next post. I keep getting a 403 error when trying to attach an image or .txt file of the code.


    I think that my issue might be from using ObjectValue for one of the cells. I'm doing that because it's for a multi-picklist and I followed the SDK documentation on github:

    https://github.com/smartsheet-platform/smartsheet-csharp-sdk/blob/master/IntegrationTestSDK/MultiPicklistTest.cs

  • // Helper function to build rowsToAdd list

        static Row ScheduleRowToAdd(EAOpportunity opportunity)

        {

          var addOpportunityNo = new Cell

          {

            ColumnId = scheduleColumnMap["Opportunity No."],

            Value = opportunity.OpportunityNumber //string

          };

          var addOpportunityStatus = new Cell

          {

            ColumnId = scheduleColumnMap["Opportunity Status"],

            Value = opportunity.OpportunityStatus //string

          };

          var addOnsiteDate = new Cell

          {

            ColumnId = scheduleColumnMap["Onsite Date"],

            Value = opportunity.OnsiteDate //DateTime

          };

          var addOwner = new Cell

          {

            ColumnId = scheduleColumnMap["SSC Owner"],

            Value = opportunity.Owner //string

          };

          var addTeamMembers = new Cell

          {

            ColumnId = scheduleColumnMap["Team Members"],

            ObjectValue = new MultiPicklistObjectValue(opportunity.TeamMembers) //IList<string>

          };

          var addRegion = new Cell

          {

            ColumnId = scheduleColumnMap["Region"],

            Value = opportunity.Region //string

          };

          var addWHOTO = new Cell

          {

            ColumnId = scheduleColumnMap["Sales & Service Center"],

            Value = opportunity.Whoto //string

          };

          var addCustomer = new Cell

          {

            ColumnId = scheduleColumnMap["Customer"],

            Value = opportunity.Customer //string

          };

          var addClosureDate = new Cell

          {

            ColumnId = scheduleColumnMap["Closure Date"],

            Value = opportunity.ClosureDate //DateTime

          };

          var rowToAdd = new Row

          {

            ToTop = true,

            Cells = new Cell[] { addOpportunityNo, addOpportunityStatus, addOnsiteDate, addOwner, addTeamMembers, addRegion, addWHOTO, addCustomer, addClosureDate }

          };

          return rowToAdd;

        }

  • Yep, you're right! Some of my lists that I used to populate ObjectValues were empty. Thanks!

  • Genevieve P.
    Genevieve P. Employee Admin

    Great! Glad you were able to sort it out. 🙂