"Cannot complete this action" when trying to create a document library
I came across a ssituation today where I was trying to create a document library in a site that I had recently worked on, but I found that as soon as I clicked "Document Library" on the create page, I would get the following error:
Cannot complete this action. Please try again. at Microsoft.SharePoint.Library.SPRequestInternalClass.GetSchemaXML(String bstrUrl, String bstrListName, UInt32 sch, Boolean bOnlyViewAttributes, Boolean bExtendedFieldsProperties, ISPDataCallback pXMLCallback) at Microsoft.SharePoint.Library.SPRequest.GetSchemaXML(String bstrUrl, String bstrListName, UInt32 sch, Boolean bOnlyViewAttributes, Boolean bExtendedFieldsProperties,ISPDataCallback pXMLCallback)
After looking around for some answers I came across this on the MSDN forums. The answer pointed me in the direction of looking at my custom site definition and what was defined in it. I figured if the code was looking for the web temp files as the forum answer suggested then chances are it was looking for the onet.xml file as well,which then led me to look at something that was obviously missing from my onet.xml file. I had (for whatever reason) missed the DocumentTemplates section, as in skipped the element completely. It didn't stop the site from working and until now no one had noticed any issues.
The good news though is that this is totally fixable without having to worry about the fact that its already in production and being used. I just took the DocumentTemplates section from the STS site definition onet.xml file and pasted it in to my onet.xml, and then did an upgrade of my WSP file. As soon as the upgrade was done I went back and found that everything was working as expected. So putting two and two together from that forum post (and this is just an educated guess) I would assume that the create page for a document library is referring to the onet.xml file for information on document templates that it should put in place. Not something I was aware was happening, but something I will definitely keep in mind for my next site definition!
No new comments are allowed on this post.
Comments
Milano
Hello Brian,
I get the first part of the solution.
But what do you mean by : and pasted it in to my onet.xml, and then did an upgrade of my WSP file
Where can i find my own onet.xml file? can you give me a detaild solution on that part?
Regards Milano Lens Holland, Amsterdam
Brian Farnhill
I got this problem because of a custom site definition we wrote for the site. Do you know if you are using a custom site definition for the site that is having the trouble? (When you chose to create the site did you choose "Team site", "blank site" etc?)
Milano
Hi Brain,
The only problem is have know is the part where you say "and then did an upgrade of my WSP file". The copy and paste part with the onet.xml file i get now.
The "and then did an upgrade of my WSP file" i dont get.
Regards Milano Lens
Milano
Sorry for misspelling your name Brian
Regards Milano
Brian Farnhill
lol, don''''t worry about the name spelling thing, I get that a lot :-)
How did you deploy your custom onet.xml file? I always do that with a WSP file, but if you just manually put in in the 12 hive then you obviously won''''t have a WSP file and can just manually update the file.
Daniel Scott
Thankyou Thankyou Thankyou!
Your post saved me untold possible hours of beating my head against a wall.
For the record, all that is required to defeat this error is an empty <DocumentTemplates /> element beneath the root <Project> element of the site definition''''s onet.xml file (you don''''t actually need any document templates defined).
In my case I elected not to have any document templates since as far as I''''m aware they''''re something of a legacy thing and setting all your lists to use Content Types is a better scheme (at least the one I prefer).
To prevent any further possible stuff-ups like this I also added an empty <ListTemplates /> element to my onet.xml file.
Hope that helps someone as much as the original post helped me!
Cheers
Daniel
Daniel Scott
HUGE thanks to Brian for the post and another Daniel Scott above me for providing further details. I did exactly that (added an empty DocumentTemplates element beneath
Tom
Hi Brian, I got some issue when I create a new site in sharepoint publish site. the error is below:
Cannot complete this action.
Please try again. at Microsoft.SharePoint.Library.SPRequestInternalClass.ListRegionalOptions(UInt32 dwCategory, UInt32 dwOption, String bstrUrl) at Microsoft.SharePoint.Library.SPRequest.ListRegionalOptions(UInt32 dwCategory, UInt32 dwOption, String bstrUrl)
could you help me ?