Friday, November 21, 2014

Angular Filters : Have Fun with Angular Filters



http://onehungrymind.com/fun-with-angularjs-filters-paleo-edition/

Thursday, November 13, 2014

Retrieve Author / Lookup Fields from Sharepoint Lists


 Reference :

How about a simple query:
 /_api/web/lists/getbytitle('<list title>')/items(<item id>)
which will return all the field values for a list item with some limitation for User/Lookup fields:
  • only lookup id values will be retrieved.
In order to request all the field values including User/Lookup field values, you could specify * to select all the fields plus to specify projected fields explicitly:

/_api/web/lists/getbytitle('<list title>')/items(<item id>)?$select=<projected field>/Id,<projected field>/Title,*&$expand=<projected field>

For exampe; in order to request all the field values including projected fields (like Author and Editor user fields) the following query could be used:

/_api/web/lists/getbytitle('<list title>')/items(<item id>)?$select=Author/Id,Author/Title,Editor/Id,Editor/Title,*&$expand=Author,Editor




.js file

 function getIssueTrackerPartials()
    {
       
            var deferred = $q.defer();

            $http({
                method: 'GET',
                url: '_api/web/lists/getbytitle(\'Issue Tracker\')/items?$select=Id,Title,IssueDescription,IssueStatus,Severity,Modified,Created,DepartmentAD,Author/Title&$expand=Author&$orderby=Title'
            }).success(function (data) {
                common.logger.log("retrieved LP partials via ngHttp", data, serviceId);
                deferred.resolve(data.d.results);
            }).error(function (error) {
                var message = "data context ngHttp error: " + error.message;
                common.logger.logError(message, error, serviceId);
                deferred.reject(error);
            });

            return deferred.promise;
    }

.HTML

<td class="ms-cellstyle ms-vb2">
                    <div class="ms-rtestate-field" data-ng-click="vm.gotoItem(lp)">{{lp.Author.Title}}</div>
                </td>