简体   繁体   中英

C# SDK Smartsheet Post w/ API

Morning all,

Using the c# sdk to write a program to post/update smartsheet with information from a database. I am in need of an explanation on how to post to both a checkbox and contact list field in smartsheet.

ie - checkbox shows as boolean value? however when i send a TRUE, FALSE, true, false, etc. values it is not the proper value. What exactly is needed to post and check a box or not?

as for contact list -

"contactOptions": [ { "name": "ed eddy", "email": "e.eddy@mail.com" }

is an example of value in there (json) do the values sent in order to update this field have to be in json format? what is needed to add new contacts, or select one of the existing contacts? there is NO documentation or explanation in the api2.0 documentation - and hoping i get a response better than one saying to reference api docs because it is not there.

--last attempt at using sdk before backend coding items since direct contact with smartsheet is unresponsive and clearly frowned upon >.>

Setting the value of a checkbox column to true should check the box. You want to be sure you're setting the value and not the displayValue .

Will you post your code so that we can see where the disconnect is?

As for updating the contactOptions of a CONTACT_LIST column it states in the documentation that if your setting contactOptions that you must also set the type to CONTACT_LIST . What isn't clear is that it's talking about the body of the same request for setting contactOptions .

For example, hitting the API directly, you would use a request body like this

{
  "contactOptions":[
       {
            "name": "Susan",
            "email": "susan@example.com"
        }

    ],
    "type": "CONTACT_LIST"
}

With the C# SDK, you can be a little more direct, since you're dealing with a column object that already has a type associated with it. That would look something like this:

 Contact newContact = new Contact();
 newContact.Name = "Susan";
 newContact.Email = "susan@example.com";

 column.ContactOptions = new Contact[] { newContact };
 ss.SheetResources.ColumnResources.UpdateColumn(sheetId, column);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM