Git Product home page Git Product logo

sharepoint's Introduction

最近在整理这几年做过的项目经验,这一部分是基于sharepoint平台,前端使用的是angular.js框架

  • 希望能够帮助到sharepoint开发者,如果好评,请不要吝啬给个star,谢谢

SPService.js

  • SP API的集合

SPPage.js

  • SP 的分页

caml.js

  • 这个是之前使用caml时候,遇到的一些查询,对于sharepoint开发,基本够用,需要注意的是 使用caml的时候,你需要给你的项目添加camljs.js

使用方法 - Demo

Js部分 - 需要注入SPService.js

(function () {
    'use strict';

    angular.module('NgSP.Page')
    .controller('PageDemoController', PageDemoController);

    PageDemoController.$inject = ['$scope', '$q', 'SharePointJSOMService'];

    function PageDemoController($scope, $q, SharePointJSOMService) {
        function init() {
            $scope.pageInfo = new PageManager($scope.pernumber, $scope.maxsize, loadData);
        }

        function loadDate() {
            let  pageInfo = '';
            const last = $scope.pageInfo.getLastItem();
            const limit = $scope.pageInfo.getRowLimit();

            if (last) {
                const info = {
                    ID: last.ID || '0',
                    Date: last.Date.toISOString() || ''
                };

                pageInfo = $scope.pageInfo.getPageInfo(info);
            }

            let camlQuery = new CamlBuilder().View().RowLimit(rowLimit).Query().Where().CounterField('ID').GreaterThan(0);

            query('这是一个sharepoint列表名字',pageInfo, camlQuery, '子站点url').then((data) => {
                $scope.pageInfo.pushData(data);
                $scope.pageInfo.showPageItems();
            });        
        }

        function query(listName, pageInfo, camlQuery) {
            let deferred = $q.defer();
            
            SharePointJSOMService.query(listName, camlQuery.ToString(), pageInfo, url, true).then((data) => {
                const dataEnumerator = data.getEnumerator();
                const list = [];
                while (dataEnumerator.moveNext()) {
                    var listItem = dataEnumerator.get_current();
                    list.push(Colleague.createFrom(listItem));

                    deferred.resolve(list);
                },
                function (err) {
                    deferred.reject(err);
                });
            })

            return deferred.promise;
        }

        init();
        loadDate();
    }
})();
  • query这个方法建议写在factory中,不知道factory的,链接1
  • camlQuery是sharepoint的查询,不知道的,链接1 链接2, 你也可以下载CAML Query开发工具(打开sharepoint online的列表即可使用) caml查询,我之前也做了一些笔记

html部分 - 演示如何使用pageInfo的

<div>
    <table>
        <thead>
            <tr>
                <th>标题</th>
                <th>工号</th>
            </tr>
        </thead>
        <tbody>
            <tr ng-repeat="data in pageInfo.currentPageData">
                <td ng-bind="data.Title"></td>
                <td ng-bind="data.JobNumber"></td>
            </tr>
        </tbody>
    </table>
    <div>
        <uib-pagination total-items="pageInfo.bigTotalItems" max-size="pageInfo.maxsize" ng-model="pageInfo.bigCurrentPage" previous-text="&lt;" next-text="&gt;" items-per-page="pageInfo.pernumber" boundary-link-numbers="true" rotate="false" ng-change="pageInfo.showPageItems()"></uib-pagination>
    </div>
</div>
  • uib-pagination是一个插件

sharepoint's People

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.