深入浅出SharePoint—对不同类型的字段进行赋值
来源:互联网 发布:淘宝联盟 pid 编辑:程序博客网 时间:2024/05/19 00:55
SPFieldLookupValue对象即为查阅项的值,它有两个属性,分别是LookupId和LookupValue,LookupId为此查阅项的值在数据源List中的ItemID,LookupValue为此查阅项的值在数据源List中所对应的值,一般构造语句为SPFieldLookupValue myValue = new SPFieldLookupValue(LookupId, LookupValue),其默认Display出来的值得格式为“LookupId,#;LookupValue”
using System;using Microsoft.SharePoint; namespace ConsoleApp{ class Program { static void Main(string[] args) { using (SPSite site = new SPSite("http://localhost")) { using (SPWeb web = site.RootWeb) { SPList customerList = web.Lists.TryGetList("Contoso Customers"); SPList orderList = web.Lists.TryGetList("Contoso Orders"); if (customerList != null && orderList != null) { SPListItemCollection customers = customerList.Items; SPListItemCollection orders = orderList.Items; string fieldName = "CustIDLookup"; if (!orderList.Fields.ContainsField(fieldName)) return; SPField lookupFld = orderList.Fields.GetField(fieldName); foreach (SPListItem customer in customers) { SPListItem order = orders.Add(); order[SPBuiltInFieldId.Title] = "Thank you!"; order.Update(); SPFieldLookupValue value = new SPFieldLookupValue(customer.ID, customer.ID.ToString()); order[lookupFld.Id] = value.ToString(); order.Update(); } } } } } }}
- 深入浅出SharePoint—对不同类型的字段进行赋值
- 深入浅出SharePoint—字段类型定义
- 不同类型的数据层如何进行属性字段的连接?
- 不同类型变量赋值的讨论
- 面对不同类型的数值,我们如何使用结构体进行赋值
- 深入浅出SharePoint——常用的SharePoint账号
- 深入浅出SharePoint——InvokeWorkflow的妙用
- Sharepoint 列表字段赋值取值方法
- 深入浅出SharePoint—目录
- 不同类型的数据进行运算
- 如何对字段进行相关的校验?
- mysql对表的字段进行操作
- Swift中随机数的使用,对不同类型随机数进行封装调用
- 深入浅出SharePoint——SharePoint补丁纪实
- 对sharepoint 的form library的事件进行处理(三)部署到sharepoint
- 深入浅出SharePoint—部署篇
- 深入浅出SharePoint—创建ContentType
- source_insight3.5字体全部变成了黑色,不能对不同类型的字段显示不同的颜色,如何解决?
- 浅谈Android五大布局(二)——RelativeLayout和TableLayout
- hadoop分布式并行编程入门
- 利用JAVA操作EXCEL文件
- Python语言的第一个程序 Hello World。。。。
- [Android in-app billing第2篇]Implementing In-app Billing實作應用程式內部金流機制(中文翻譯)
- 深入浅出SharePoint—对不同类型的字段进行赋值
- Linux Signal 调用时,系统的处理
- polya 计数法,burnside定理 学习小结
- FVWM-Rio: FVWM 仿 Plan9 Rio 窗口管理器主题
- [Android in-app billing第3篇]Security and Design安全與設計(中文翻譯)
- [Android in-app billing第4篇]Testing In-app Billing測試應用程式內金流機制(中文翻譯)
- [Android in-app billing第5篇]Administering In-app Billing應用程式內金流機制的管理(中文翻譯)
- ms sql拼表
- [Android in-app billing第6篇(末)]In-app Billing Reference應用程式金流的相關API(中文翻譯)