I have a custom Document Library that has a custom content type which is an extension of a Folder (just adding some more fields). I'm trying to, in code, add a new item of this content type to the library. But I get the error:
To add an item to a document library, use SPFileCollection.Add()
But what I am adding is not a file, and all the overloads for that method require some kind of file stream or object. I've tried:
SPListItem newCustomFolder = docLibrary.Folders.Add(); SPListItem newCustomFolder = docLibrary.AddItem(); SPListItem newCustomFolder = docLibrary.Items.Add();
And trying to declare it as SPFolder doesn't match the return of the above functions nor does accept setting fields.
How do I do this?