我有一个这样创建的列表:
private void CreateMemberList(SPWeb web, SPList list, SPView view, StringCollection departmentSelection)
{
// Add Outr Fields
list.Fields.Add("MemberID", SPFieldType.Integer, true);
list.Fields.Add("MemberName", SPFieldType.Text, true);
list.Fields.Add("Department", SPFieldType.Choice, true, false, departmentSelection);
// Set the default value and the format of the choice.
SPFieldChoice fieldChoice = (SPFieldChoice)list.Fields["Department"];
fieldChoice.DefaultValue = "Select One";
fieldChoice.EditFormat = SPChoiceFormatType.Dropdown;
//Add the Lookup field
SPList targetList = web.Lists["Certification"];
list.Fields.AddLookup("MemberCertifications", targetList.ID, false);
SPFieldLookup lookup = (SPFieldLookup)list.Fields["MemberCertifications"];
lookup.LookupField = targetList.Fields["CertificationTitle"].InternalName;
lookup.AllowMultipleValues = true;
lookup.Update();
list.Update();
//Add Member View
view.ViewFields.Add("MemberID");
view.ViewFields.Add("MemberName");
view.ViewFields.Add("Department");
view.ViewFields.Add("MemberCertifications");
//Update Views
view.Update();
}
此函数在激活时调用。有没有办法list.Fields.add - photofield
让用户上传特定条目的照片?