Reputation: 14095
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.
Upvotes: 3
Views: 3231
Reputation: 41
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.
Upvotes: 4