To add an item to a document library, use SPFileCollection.Add()
-
04-10-2020 - |
Question
I have created a Gantt view for document library. Everything configured correctly. But when user add item using inline editing user gets error
"To add an item to a document library, use SPFileCollection.Add()"
. But same thing work perfectly for lists, but not working for document libraries. Is it a known issue in SP2013?
Solution
Yes, you cannot create an item in a document library without an associated file. Inline editing lets you fill in the column data, but does not have an interface for uploading a file, and thus cannot be used to create new documents in a library. This behavior is inherent to document libraries.
Every item in a document library needs to have an underlying file or folder before you can fill in the item's metadata.