Попытка получить элемент списка гиперссылок SharePoint 2016 REST API - PullRequest
0 голосов
/ 24 апреля 2020

Я пытаюсь получить элемент списка гиперссылок из моего angularjs контроллера.

app.controller('myController', function($scope, $http, $filter) {
    method: 'GET',
    url: "https://.../_api/web/lists/GetbyTitle('hightlights')/items?$top=1000$select=Product",
    header: {"Accept": "application/json;odata=verbose}
    }).success(function(data, status, headers, config) {
        $scope.products = data.d.results;
        console.log($scope.products);
   ...

Но на моей странице я получаю следующее:

{"__metadata:"{"type":"SP.FieldUrlValue"},"Description":"https://...","Url":"https://..."}

Как мне получить часть URL?

1 Ответ

1 голос
/ 27 апреля 2020

Мой тестовый скрипт для вашей справки:

    myAngApp.controller('spCustomerController', function ($scope, $http) {  
            $http({  
                method: 'GET',  
                url: _spPageContextInfo.webAbsoluteUrl + "/_api/web/lists/getbytitle('links')/items?$select=URL",  
                headers: { "Accept": "application/json;odata=verbose" }  
            }).success(function (data, status, headers, config) {  
                $scope.customers = data.d.results;  
                                                    console.log($scope.customers);

 $scope.customers.forEach((item,index,array)=>{
        console.log(item.URL.Url)
    })
            }).error(function (data, status, headers, config) {  

            });  
    });
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...