I got this error while creating a document library in sharepoint.
A list, survey, discussion board, or document library with the specified title already exists in this Web site. Please choose another title.
Here is my coding.
SPSite site = new SPSite(url);
SPWeb oWebsite = site.OpenWeb();
oWebsite.AllowUnsafeUpdates = true;
Guid customListID = oWebsite.Lists.Add(docLibraryName, docLibraryName, SPListTemplateType.DocumentLibrary);
oWebsite.Update();
oWebsite.AllowUnsafeUpdates = false;
Thanks.
UPDATE:
forget to mention that there is no such document library with the name I am trying to add.
Use SharePoint designer and connect to that site. You may find that a folder with that name has been created which is causing the code to think that the list already exists. Delete that folder and you should be all set.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With