We have discussed how to add or update a user-type item. This is because the user type is special. As the end of the SharePoint Web Service series, we will discuss how to write various other types of items.
The SDK contains the following table. Our writing relies entirely on this basis.
Name |
Format |
Attachments |
System. Boolean |
Boolean |
System. Boolean |
Calculated |
N/ |
Choice |
System. String |
Computed |
N/ |
Counter |
System. int32 |
Crossprojectlink |
System. Boolean |
Currency |
System. Double |
Datetime |
System. datetime |
Gridchoice |
System. String |
Guid |
System. guid |
Integer |
System. int32 |
Lookup |
System. String |
Maxitems |
System. int32 |
Modstat |
System. int32 |
Multichoice |
System. String |
Note |
System. String |
Number |
System. Double |
Recurrence |
System. Boolean |
Text |
System. String |
Threading |
System. String |
URL |
System. String, system. String |
User |
System. String |
This table shows the comparison between various field types in WSS and the corresponding data types in. net. Based on this, we can easily write the content in the <field> element.
For example, we want to add or update a URL-type field. You can write the field like this: <field name = "someurl"> http://www.example.com, example </field>
In this example, the someurl field of a list item is of the link type. We need to write a link to this field. The URL for this link is http://www.example.com and titled example ".
Note: For link fields, you can leave the title empty. (In this way, the system uses the address content as the title by default, which is the same as many text editors .) So the above example can also be written as follows: <field name = "someurl"> http://www.example.com, </field>
Another example is to add or update an option field. You can write the field as follows: <field name = "status"> completed </field>
The Status field in the task list is of the Option type. because it corresponds to system. String, you can directly write it like this.