MSDN post history http://social.msdn.microsoft.com/Forums/zh-CN/sharepointwebpartzhchs/thread/1bef6db4-d95a-4bbb-88e3-ea5e89a0f5e5
Q:
By default, only one person or group can be selected in the Assigned To field of the new task item,
However, if I want to select two or more people, this will not work. I need to go to Team Site> Tasks> Settings> Edit Column and select "Yes" for Allow multiple selections.
How to implement it using code: The Allow multiple selections option is Yes, and the default value is 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(); }
Thank you! The solution Justin Liu provided me!
In addition:
Derived class of 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 tags: sharepoint, task, assigned