JOJ
踏踏实实做人,认认真真做事!放纵自己就是毁灭自己!

MSDN帖子记录http://social.msdn.microsoft.com/Forums/zh-CN/sharepointwebpartzhchs/thread/1bef6db4-d95a-4bbb-88e3-ea5e89a0f5e5

Q:

在新建一个task item的Assigned To字段默认只能选择一个人,或者一个组,

但是这里如果我想选择2个人或者2个以上,则不行,需要去Team Site > Tasks > Settings > Edit Column   把 Allow multiple selections 选择Yes

如何用代码实现: Allow multiple selections 选项为 Yes , 默认为 No

 

A:

using (SPSite site = new SPSite("http://moss:5000"))
         using (SPWeb web = site.RootWeb)
         {
             web.AllowUnsafeUpdates = true;
             SPList list = web.Lists["Tasks"];
             SPFieldLookup userField = list.Fields["Assigned To"] as SPFieldLookup;
             userField.AllowMultipleValues = true;
             userField.Update();
         }
谢谢: Justin Liu 给我提供的解决方案! 
 
另:
Microsoft.SharePoint.SPField 的派生类:
 
Microsoft.SharePoint.SPFieldAttachments

Microsoft.SharePoint.SPFieldBoolean

Microsoft.SharePoint.SPFieldCalculated

Microsoft.SharePoint.SPFieldComputed

Microsoft.SharePoint.SPFieldCrossProjectLink

Microsoft.SharePoint.SPFieldDateTime

Microsoft.SharePoint.SPFieldFile

Microsoft.SharePoint.SPFieldLookup

Microsoft.SharePoint.SPFieldMultiChoice

Microsoft.SharePoint.SPFieldMultiColumn

Microsoft.SharePoint.SPFieldMultiLineText

Microsoft.SharePoint.SPFieldNumber

Microsoft.SharePoint.SPFieldPageSeparator

Microsoft.SharePoint.SPFieldRecurrence

Microsoft.SharePoint.SPFieldText

Microsoft.SharePoint.SPFieldUrl

 
Technorati 标签: sharepoint,task,assigned to
posted on 2010-11-24 16:44  JoinJ  阅读(595)  评论(0编辑  收藏  举报