0

I am trying to deploy two files to a custom list. I created two features for this: one that holds the list definitions along with the module and one that contains the list instances. Both are in the same package.

However, I always get the above error when deploying the files with the attribute "Type" set to "GhostableInLibrary". I already tried numerous things like moving the URL to the module/each file element to no avail. In the URL, the List is "ActivityReports" and "Templates" is a subfolder in the list.

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <Module RootWebOnly="FALSE" Name="Templates" Url="Lists/ActivityReports/Templates" Path="Templates">
    <File Url="Template1.xlsx" Type="GhostableInLibrary" IgnoreIfAlreadyExists="FALSE" />
    <File Url="Template2.xlsx" Type="GhostableInLibrary" IgnoreIfAlreadyExists="FALSE" />
  </Module>
</Elements>

Anybody see anything wrong my Elements.xml file?

2 Answers 2

2

Remove "Lists/" from your module's Url parameter.

<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <Module RootWebOnly="FALSE" Name="Templates" Url="ActivityReports/Templates" Path="Templates">
    <File Url="Template1.xlsx" Type="GhostableInLibrary" IgnoreIfAlreadyExists="FALSE" />
    <File Url="Template2.xlsx" Type="GhostableInLibrary" IgnoreIfAlreadyExists="FALSE" />
  </Module>
</Elements>

Update:
Just re-read your question. You write this Module is in the feature holding the List Definition - That's just the definition. It's the List Instance feature you want to include this module in.
You cannot add stuff to lists/libraries that does not exist yet.

8
  • I still get the same error :( Commented Apr 21, 2015 at 8:36
  • @LeonidasFett Chech my update.
    – user2536
    Commented Apr 21, 2015 at 8:42
  • even after moving the module to the list instance feature, I get the same error Commented Apr 21, 2015 at 8:49
  • @LeonidasFett Does your Templates module come after List Instance in the feature?
    – user2536
    Commented Apr 21, 2015 at 8:52
  • the module is at the very bottom of the feature while the ActivityReports instance is one position above it. Commented Apr 21, 2015 at 8:54
1

Try changing Type="GhostableInLibrary" to Type="Ghostable" in the elements.xml file. This fixed the issue for me.

MSDN discussion related to this problem

Blog post confirming the fix

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.