Question

I'm trying to pull some fields from my Document Library. Right now, I can retrieve these 2 fields to return the correct values, in my success function.

while (listItemEnumerator.moveNext()) {
  var oListItem = listItemEnumerator.get_current();
  alert(oListItem.get_item('Title'));
  alert(oListItem.get_item('UserField1'));
}

But when I try to call a computed field, such as 'NameOrTitle' oListItem.get_item('NameOrTitle')); I get IE telling me the property or field has not been initialized. It has not been requested or the request has not been executed. It may need to be explicitly requested.

This value has content inside it right now. And I need it, as it's displaying the file name. How can I get this field? I have looked elsewhere and I have read stuff about doing:

context.load(allItems, 'Include(NameOrTitle)');

Then in my succeess function, I do oListItem.get_nameOrTitle(). Is this correct?

Well I do that and now I'm getting

Object doesn't support property or method 'get_nameOrTitle'

Please help. Thanks.

Was it helpful?

Solution

oListItem.get_item('FileRef');

Will get me the url

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top