开发者

Adding SPFieldType.File to a custom list

开发者 https://www.devze.com 2023-02-05 04:22 出处:网络
When I try to add a File type field to a custom list I get System.InvalidOperationException: Operation is not valid due to the current state of the object

When I try to add a File type field to a custom list I get

System.InvalidOperationException: Operation is not valid due to the current state of the object

Guid listGuid = adminWeb.Lists.Add(queueListName, "DotNetNuke Document Queue", SPListTemplateType.GenericList);

queueList = adm开发者_StackOverflowinWeb.Lists[listGuid];
queueList.Fields.Add("Status", SPFieldType.File, false);

queueList.Update();


I don't believe that you can have a "File" field. If you look in the UI, there is no "File" field type for custom/generic list.

If you need 1 file per item and it is mandatory, then you should be using a document library.

If you need more than 1 file per list item, then file attachments is the way to go.

0

精彩评论

暂无评论...
验证码 换一张
取 消