2

I created a custom content type and a page layout for it. Publishing Feature is activated on my site collection. Now, I can flawlessly create some pages out of this content type in the Pages Library.

Now, I want to create a document library with my custom content type as default type, but when I want to create a page, I get :

System.ArgumentException: Value does not fall within the expected range.
at Microsoft.SharePoint.Utilities.SPUtility.CreateParentFoldersForFile(SPList list, String url, Boolean createAsListItem)
at Microsoft.SharePoint.Publishing.Internal.CodeBehind.CreatePagePage.NewPageItemSave(String pageName, PageLayout pageLayout, String folderUrl, Boolean redirect)
at Microsoft.SharePoint.Publishing.Internal.CodeBehind.CreatePagePage.CreateStandardPage(String pageName)
at Microsoft.SharePoint.Publishing.Internal.CodeBehind.CreatePagePage.ButtonCreatePage_Click(Object sender, EventArgs e)
at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint... 
  • hate this error. had one like that about expected range, turned out to be a column added programatically with AddFieldAsXml that then had duplicate fields. possibly not your case, but thought I would mention. maybe check ULS for more details – Tiago Duarte Jan 11 '18 at 14:01
  • Is it even possible to store application pages in a library other than the Pages library? – Jul Jan 12 '18 at 10:44
  • This error message is out of ULS. – Jul Jan 12 '18 at 10:52
0

According to this Question: Custom Content Type always results in ArgumentException

The function SPUtility.CreateParentFoldersForFile verfifies that the new item based on a publishing content type is stored in the Pages library. If not you get the error above.

Key takeaway: Publishing Content types only in the Publishing Library, aka. Pages.

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.