Get item from external list field with ajax - SP2013
-
07-02-2021 - |
Question
I have a list and some columns retrieve value from external list. How to get all items from that list(attached img) with REST
I'm trying like this
function traerSolicitudes() {
var lista = "MetadataTabla";
var siteUrl = _spPageContextInfo.webAbsoluteUrl;
var hostweburl = _spPageContextInfo.webAbsoluteUrl;
+_spPageContextInfo.webServerRelativeUrl;
var scriptbase = hostweburl + "/_layouts/15/";
$.getScript(scriptbase + "SP.RequestExecutor.js", ejecutarCrossDomain);
function ejecutarCrossDomain() {
var executor = new SP.RequestExecutor(siteUrl);
var urlRest = siteUrl + "/_api/web/lists/GetByTitle('"
+ lista + "')/items?";
myList = [];
traerTodosLosItems();
function traerTodosLosItems() {
executor.executeAsync({
url: urlRest,
type: "GET",
headers: {
"accept": "application/json;odata=verbose",
},
success: function (data) {
var jsonObject = JSON.parse(data.body);
$.each(jsonObject.d.results, function (index, item) {
console.log(jsonObject.d.results)
});
},
error: function (error) {
alert(JSON.stringify(error));
}
});
}
}
}
Result:
the REST retrieve just field items like datetime, text and number, but not "external data" type, in the console.log external data fields type return NULL
La solution
this is the way I retrieve the external content type items. I define all fields i want to retrieve in the select of the rest api
$select=metadata_tablaID,informacion,valor,tipo_de_dato," +
"duenho,fecha_de_carga,fecha_de_vigencia,selloID,capituloID,checklistID,frameworkID,grupoID,maestroClasificadorID,nivelID
Licencié sous: CC-BY-SA avec attribution
Non affilié à sharepoint.stackexchange