2

The short story, when trying to execute SPListCollection.EnsureSiteAssetsLibrary I get:

Exception calling "EnsureSiteAssetsLibrary" with "0" argument(s): "A list, survey, discussion board, or document library with the specified title already exists in this Web site. Please choose another title." At line:5 char:1 + $siteAssets = $currentWeb.Lists.EnsureSiteAssetsLibrary(); + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : SPException

And here's the longer version.

I have 2 environments (DEV and INT), both with the same 2007 migrated database. On each environment, I have this site collection with multiple subsites.

I developed a feature which is supposed to deploy some JS files in the Site Assets library on each subsite.

<Module Name="Scripts" Url="SiteAssets">
  <File Path="Scripts\someScript.js" Url="someScript.js" Type="GhostableInLibrary"/>
  ....
</Module>

The problem is that originally, the 2007 subsites didn't have the Site Assets library, so the feature activation failed. In order to prevent that, I'm ensuring that the library exists through a PowerShell script.

Now, when I execute the EnsureSiteAssetsLibrary in PS, I get the error above only for some SPWebs.

The behavior is inconsistent in DEV and INT, so that the number of SPWebs on which the script fails is not the same (this could be or not be a hint for finding the right answer).

My question would be: why is the exception being thrown, when on MSDN we have the following remark?

If this list does not exist one is created and returned. If multiple such lists exist only one is returned.

[UPDATE]

It seems that the feature activation failure somehow corrupts the SPWeb (I also get these symptoms). In the ULS:

The list "$Resources:core,webpageassetList;" in web "..." was not created. hr = 0x81020012.

Failed to create list "$Resources:core,webpageassetList;" in web "...", HRESULT=0x1cf6a0d0. List XML: "<List xmlns:ows="Microsoft SharePoint" Title="$Resources:core,shareddocuments_Title_15;" Direction="$Resources:core,Direction;" Url="Shared Documents" BaseType="1"/>"

3

The module will create the underlying folder structure and so the the creation of the asset library will fail! Clean the folder structure and everything will be fine!

1

This problem can occur if the site already contains a folder called "Site Assets" - perhaps created by your Module. You can check this using SharePoint Manager (http://spm.codeplex.com) and then browsing the fold.

0

I had the same issue and followed the advice in this link.

http://johnmhester.wordpress.com/2014/01/31/error-changing-a-site-title-in-sharepoint-2013/

basically it says to delete the site assets library and then press the title, logo and description link again.

regards

Daniel

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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