Use code To implement Assigned To select multiple persons in the task list

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.