1.10.66 • Published 2 years ago

jitz-sharepoint-utilities v1.10.66

Weekly downloads
159
License
ISC
Repository
-
Last release
2 years ago

JitzSharePointUtilities

Easily pluggable data layer for SharePoint Framework(SPFx) applications following Repository pattern and some SharePoint utilities

Prerequisites

Create the SPFx project according to Microsoft's documentation

How to use

Install the package using the command below

npm i jitz-sharepoint-utilities

Import the package in your project

import UtilityService from 'jitz-sharepoint-utilities/lib/services/UtilityService';
import UserService from 'jitz-sharepoint-utilities/lib/services/UserService';
import { IRepository } from 'jitz-sharepoint-utilities/lib/repositories/IRepository';
import Repository from 'jitz-sharepoint-utilities/lib/repositories/Repository';

export interface IProduct extends IModel{ 

}

Create the data model for the lists used on the project

import { IModel, IPersonOrGroup } from 'jitz-sharepoint-utilities/lib/common/IModels';

export interface IProduct extends IModel{ 
    customFieldsInTheList:string;
    ....
    ....
}

Create the repository class for the list

import { IWebPartContext } from '@microsoft/sp-webpart-base';
import {IProduct} from '../yourModelFile';
import Repository from 'jitz-sharepoint-utilities/lib/repositories/Repository';


export default class ProductRepository extends Repository<IProduct> {
    
    constructor(context: IWebPartContext,_listName:string="Products"){
        super(context,_listName);
    }
   

}

Use the repository

import { IRepository } from 'jitz-sharepoint-utilities/lib/repositories/IRepository';

private _productRepository:IRepository<IProduct>;

constructor(props: yourProps, state: yourState) {
        super(props);
        this.state = {
            ...
            ...
        };

        this._userService = new UserService(this.props.context);
        this._productRepository = new ProductRepository(this.props.context);
      }

getProducts = () => {
    this._productRepository.getAll().then((data)=>{
        ...
        ...
    });
}

Use User service

this._userService.getCurrentUser().then((user){});
this._userService.getCurrentUserGroups().then((groups){});
this._userService.checkIfCurrentUserInGroup(groupName).then((result){});
this._userService.checkIfUserIsInGroup(userId, groupName).then((result){});
this._userService.getUserById(id).then((user){});

Keywords

SPFx Typescript in SharePoint components SharePoint

1.10.66

2 years ago

1.10.62

3 years ago

1.10.63

3 years ago

1.10.64

3 years ago

1.10.65

3 years ago

1.10.48

3 years ago

1.10.49

3 years ago

1.10.46

3 years ago

1.10.47

3 years ago

1.10.60

3 years ago

1.10.61

3 years ago

1.10.51

3 years ago

1.10.52

3 years ago

1.10.50

3 years ago

1.10.59

3 years ago

1.10.57

3 years ago

1.10.58

3 years ago

1.10.55

3 years ago

1.10.56

3 years ago

1.10.53

3 years ago

1.10.54

3 years ago

1.10.45

3 years ago

1.10.44

3 years ago

1.10.40

3 years ago

1.10.41

3 years ago

1.10.42

3 years ago

1.10.43

3 years ago

1.10.39

3 years ago

1.10.38

3 years ago

1.10.37

3 years ago

1.10.36

3 years ago

1.10.35

3 years ago

1.10.34

3 years ago

1.10.33

3 years ago

1.10.31

3 years ago

1.10.32

3 years ago

1.10.29

3 years ago

1.10.30

3 years ago

1.10.28

4 years ago

1.10.27

4 years ago

1.10.26

4 years ago

1.10.25

4 years ago

1.10.24

4 years ago

1.10.23

4 years ago

1.10.22

4 years ago

1.10.21

4 years ago

1.10.20

4 years ago

1.10.19

4 years ago

1.10.18

4 years ago

1.10.17

4 years ago

1.10.15

4 years ago

1.10.16

4 years ago

1.10.14

4 years ago

1.10.13

4 years ago

1.10.12

4 years ago

1.10.11

4 years ago

1.10.10

4 years ago

1.10.9

4 years ago

1.10.8

4 years ago

1.10.7

4 years ago

1.10.5

4 years ago

1.10.4

4 years ago

1.10.3

4 years ago

1.10.2

4 years ago

1.10.6

4 years ago

1.10.1

4 years ago

1.10.0

4 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago