Showing posts with label Export WSP. Show all posts
Showing posts with label Export WSP. Show all posts

Wednesday, August 29, 2012

Unable to find the default edit form for list...

So Exporting a Site as a Template and Importing it into Visual Studio can be very useful but only if it works!

I was trying to use this method to create a List and a Library Instance so I could include it into my existing solution.  I did this and it appeared as though everything worked well until I tried to upload a document in the library or create a new list item...then I would get a nasty error about
"Unable to find the default edit form for list My List"
So I looked back in the definition and for the list there was this SharePoint Module inside that was named 'Listslist_name_here_pages'and had a Elements.xml inside it with some information about the DispForm, NewForm and EditForm...

Perfect, so for the list I included this module just as it was in the other solution and low and behold it worked...but then the Library didn't have a module inside it...WTF!!! Then some more snooping lead me to see that there was a Modules folder that had 4 Modules with the corresponding names each with their own different Elements.xml files!
LibraryNameForms_1033_STS_doctemp_word
LibraryNameForms_Features_DocumentLibrary_doclib
LibraryNameForms_pages
LibraryNameFormsMy Custom ContentType_1033_STS_doctemp_word
NASTY!!!

So, being a slave to SharePoint I set out to duplicate these four modules just as they were in the imported solution...no dice...but then I got to thinking about how this works and I snooped into the Scheme.xml of the list instance and found this....
<Forms />
What?!? that's not right...so I blew away all my precious modules I worked so hard on and switched the above one line in the Scheme.xml for this...
<Forms>
  <Form Type="DisplayForm" Url="DispForm.aspx" SetupPath="pages\form.aspx" WebPartZoneID="Main" />
  <Form Type="EditForm" Url="EditForm.aspx" SetupPath="pages\form.aspx" WebPartZoneID="Main" />
  <Form Type="NewForm" Url="NewForm.aspx" SetupPath="pages\form.aspx" WebPartZoneID="Main" />
</Forms>
WOW! Its magic! just like It should be...and a much nicer, cleaner solution.

More information about the Scheme.xml can be found here