SharePoint Web Service系列: Add或Update其他各种类型的项

在前面,我们讨论了如何Add或Update类型为User的项。因为User类型多少比较特殊。作为SharePoint Web Service系列讨论的结束,我们将讨论各种其他类型的项如何来写。
在SDK中,有如下的一张表格。我们的写法完全是依托在此基础之上。
 

Name

Format

Attachments

System.Boolean

Boolean

System.Boolean

Calculated

N/A

Choice

System.String

Computed

N/A

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

这张表格显示了在WSS中的各种字段类型与.NET中对应的数据类型的对照关系。根据这个,我们就可以方便的写出<Field>元素中的内容了。
比如,我们现在要Add或Update一个URL类型的字段。可以这样书写Field:
<Field Name="SomeUrl">http://www.example.com, Example</Field>

该例中某列表项的SomeUrl字段是链接类型的,我们要写一个链接到这个字段。该链接的地址为“http://www.example.com”,标题为“Example” 。
注意:对于链接类型的字段,由于标题可以不填。(这样系统会默认以地址的内容作标题,这一点和许多文本编辑器相同。)所以上面的例子也可以这样写:
<Field Name="SomeUrl">http://www.example.com,</Field>
再如,我们现在要Add或Update一个选项类型的字段。可以这样书写Field:
<Field Name="Status">已完成</Field>

任务列表中的状态字段就是选项类型的,由于其对应的是System.String,所以可以直接这么写。

posted @ 2006-10-31 19:32  Sunmoonfire  阅读(1641)  评论(0编辑  收藏  举报