I'm trying to retrieve the corresponding ListItem from a page layout in the master page gallery using JSOM. I'm using the same approach that Vadim provides in this question, JSOM - get listitem by file url, as below:
function getAssociatedPageLayoutListItem() {
var promiseObject = new RSVP.Promise(function (resolve, reject) {
var pageLayoutListItem = web.getFileByServerRelativeUrl("/_catalogs/masterpage/MyCustomPageLayout.aspx");
clientContext.load(pageLayoutListItem, 'ListItemAllFields');
clientContext.executeQueryAsync(
function () {
resolve(pageLayoutListItem);
},
function (error) {
reject(error);
}
);
});
return promiseObject;
}
The problem is that SharePoint returns an ArgumentException with the message Value does not fall within the expected range..
ErrorInfo
ErrorCode=-2147024809
ErrorMessage=Value does not fall within the expected range.
ErrorTypeName=System.ArgumentException
ErrorValue=(null)
I have run into this exception before, and back then it seemed as it had something to do with what fields I requested, but this time I can't seem to fix it. How can I get a clearer picture of what is missing, and how to fix it?
Update Loading only the requested file throws the same error.
clientContext.load(pageLayoutListItem)

0 commentaires:
Enregistrer un commentaire