Skip to content

Commit

Permalink
updated readme for webpart sample to inlude testing instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
nmetulev committed Nov 5, 2019
1 parent 51fc9ab commit 57e2f8a
Showing 1 changed file with 42 additions and 9 deletions.
51 changes: 42 additions & 9 deletions samples/sp-webpart/README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,59 @@
## SharePoint webpart using Microsoft Graph Toolkit components

This sample is a React based SharePoint webpart that uses the Microsoft Graph Toolkit.

### Building the code

```bash
git clone the repo
npm i
npm i -g gulp
gulp trust-dev-cert
gulp
```

This package produces the following:
### Testing the webpart

Run the webpart bu running:

`gulp serve`

Open the browser to:

`https://<your-tenant>.sharepoint.com/_layouts/15/Workbench.aspx`

The webpart will be available to be added

### Approving permissions

The admin of your tenant will need to approve the graph permissions in the admin portal before you can use any graph APIs. You only need to do these steps once (or if you add additional permissions to `config/package-solution.json`)

1. Package the web part. First run the following commands:

```
gulp build
gulp bundle
gulp package-solution
```

This will create a package under `sharepoint/solution`, with the `.sppkg` extension

2. Upload the package to an app catalog. Navigate to the app catalog url and click on *Distribute apps for SharePoint*. Click on *new* to upload the solution to the app catalog and deploy it.

> If you do not have an app catalog on your tenant, follow [these steps](https://docs.microsoft.com/en-us/sharepoint/use-app-catalog#step-1-create-the-app-catalog-site-collection) to create one.
3. Approve the permissions. Go to the SharePoint admin center (best reached via https://admin.microsoft.com > click **Show All** > SharePoint) and make sure you are signed in as admin.

Under *API Management* you should see the permissions that need to be approved. Approve each one by one.

* lib/* - intermediate-stage commonjs build artifacts
* dist/* - the bundled script, along with other resources
* deploy/* - all resources which should be uploaded to a CDN.
You should now be able to test the webpart

### Build options

gulp trust-dev-cert

gulp clean - TODO
gulp test - TODO
gulp serve - TODO
gulp bundle - TODO
gulp package-solution - TODO
gulp clean
gulp test
gulp serve
gulp bundle
gulp package-solution

0 comments on commit 57e2f8a

Please sign in to comment.