문제

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.

도움이 되었습니까?

해결책

oListItem.get_item('FileRef');

Will get me the url

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top