我有一个这样创建的列表:
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
允许用户上传特定条目的照片?
答案 0 :(得分:0)
您希望在列表中创建this type字段,并将this property设置为SPUrlFieldFormatType.Image。我从来没有使用过图片字段而且不知道上传是如何工作的,但我猜测在创建和编辑表单中会有一个上传文件控件。