Upgrade to SPFx v1.7.0, update to use v1.0 MS Graph endpoints (#693)
This commit is contained in:
parent
79eb59b920
commit
0265e4c7e6
|
@ -1,10 +1,11 @@
|
|||
{
|
||||
"@microsoft/generator-sharepoint": {
|
||||
"version": "1.6.0",
|
||||
"version": "1.7.0",
|
||||
"libraryName": "teams-creator",
|
||||
"libraryId": "3284bbaa-0441-4153-9738-69a27a4b5956",
|
||||
"environment": "spo",
|
||||
"packageManager": "npm",
|
||||
"isCreatingSolution": true
|
||||
"isCreatingSolution": true,
|
||||
"isDomainIsolated": false
|
||||
}
|
||||
}
|
|
@ -13,7 +13,7 @@ The web part illustrates usage of MS Graph beta APIs to work with Teams:
|
|||
![React Side Panel Client-Side Web Part](./assets/teams-creator.png)
|
||||
|
||||
## Used SharePoint Framework Version
|
||||
![drop](https://img.shields.io/badge/drop-1.6.0-green.svg)
|
||||
![drop](https://img.shields.io/badge/drop-1.7.0-green.svg)
|
||||
|
||||
## Applies to
|
||||
|
||||
|
@ -32,6 +32,7 @@ teams-creator-client-side-solution | Alex Terentiev ([Sharepointalist Inc.](http
|
|||
Version|Date|Comments
|
||||
-------|----|--------
|
||||
1.0|October 17, 2018|Initial release
|
||||
1.1|November 19, 2018|Upgrade to SPFx v1.7.0, updated to use v1.0 MS Graph endpoints
|
||||
|
||||
## Disclaimer
|
||||
**THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.**
|
||||
|
|
|
@ -3,9 +3,10 @@
|
|||
"solution": {
|
||||
"name": "teams-creator-client-side-solution",
|
||||
"id": "3284bbaa-0441-4153-9738-69a27a4b5956",
|
||||
"version": "1.0.0.0",
|
||||
"version": "1.1.0.0",
|
||||
"includeClientSideAssets": true,
|
||||
"skipFeatureDeployment": true,
|
||||
"isDomainIsolated": false,
|
||||
"webApiPermissionRequests": [{
|
||||
"resource": "Microsoft Graph",
|
||||
"scope": "Group.ReadWrite.All"
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "teams-creator",
|
||||
"version": "0.0.1",
|
||||
"version": "1.1.0",
|
||||
"private": true,
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
|
@ -11,26 +11,25 @@
|
|||
"test": "gulp test"
|
||||
},
|
||||
"dependencies": {
|
||||
"@microsoft/sp-core-library": "1.6.0",
|
||||
"@microsoft/sp-lodash-subset": "1.6.0",
|
||||
"@microsoft/sp-office-ui-fabric-core": "1.6.0",
|
||||
"@microsoft/sp-webpart-base": "1.6.0",
|
||||
"@microsoft/sp-core-library": "1.7.0",
|
||||
"@microsoft/sp-lodash-subset": "1.7.0",
|
||||
"@microsoft/sp-office-ui-fabric-core": "1.7.0",
|
||||
"@microsoft/sp-webpart-base": "1.7.0",
|
||||
"@pnp/spfx-controls-react": "1.9.0",
|
||||
"@types/es6-promise": "0.0.33",
|
||||
"@types/react": "15.6.6",
|
||||
"@types/react-dom": "15.5.6",
|
||||
"@types/react": "16.4.2",
|
||||
"@types/react-dom": "16.0.5",
|
||||
"@types/webpack-env": "1.13.1",
|
||||
"react": "15.6.2",
|
||||
"react-dom": "15.6.2"
|
||||
"react": "16.3.2",
|
||||
"react-dom": "16.3.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@microsoft/sp-build-web": "1.6.0",
|
||||
"@microsoft/sp-module-interfaces": "1.6.0",
|
||||
"@microsoft/sp-webpart-workbench": "1.6.0",
|
||||
"tslint-microsoft-contrib": "~5.0.0",
|
||||
"gulp": "~3.9.1",
|
||||
"@microsoft/sp-build-web": "1.7.0",
|
||||
"@microsoft/sp-module-interfaces": "1.7.0",
|
||||
"@microsoft/sp-webpart-workbench": "1.7.0",
|
||||
"@types/chai": "3.4.34",
|
||||
"@types/mocha": "2.2.38",
|
||||
"ajv": "~5.2.2"
|
||||
"ajv": "~5.2.2",
|
||||
"gulp": "~3.9.1"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,19 +17,19 @@ export enum CreationState {
|
|||
/**
|
||||
* Initial state - user input
|
||||
*/
|
||||
notStarted,
|
||||
notStarted = 0,
|
||||
/**
|
||||
* creating all selected elements (group, team, channel, tab)
|
||||
*/
|
||||
creating,
|
||||
creating = 1,
|
||||
/**
|
||||
* everything has been created
|
||||
*/
|
||||
created,
|
||||
created = 2,
|
||||
/**
|
||||
* error during creation
|
||||
*/
|
||||
error
|
||||
error = 4
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -38,7 +38,7 @@ export enum CreationState {
|
|||
export interface ITeamsApp {
|
||||
id: string;
|
||||
externalId?: string;
|
||||
name: string;
|
||||
displayName: string;
|
||||
version: string;
|
||||
distributionMethod: string;
|
||||
}
|
||||
|
@ -128,7 +128,7 @@ export default class TeamsCreator extends React.Component<ITeamsCreatorProps, IT
|
|||
selectedAppId
|
||||
} = this.state;
|
||||
|
||||
const appsDropdownOptions: IDropdownOption[] = apps ? apps.map(app => { return { key: app.id, text: app.name }; }) : [];
|
||||
const appsDropdownOptions: IDropdownOption[] = apps ? apps.map(app => { return { key: app.id, text: app.displayName }; }) : [];
|
||||
|
||||
return (
|
||||
<div className={styles.teamsCreator}>
|
||||
|
@ -290,13 +290,13 @@ export default class TeamsCreator extends React.Component<ITeamsCreatorProps, IT
|
|||
const context = this.props.context;
|
||||
const graphClient = await context.msGraphClientFactory.getClient();
|
||||
|
||||
const appsResponse = await graphClient.api('appCatalogs/teamsApps').version('beta').get();
|
||||
const appsResponse = await graphClient.api('appCatalogs/teamsApps').version('v1.0').get();
|
||||
const apps = appsResponse.value as ITeamsApp[];
|
||||
apps.sort((a, b) => {
|
||||
if (a.name < b.name) {
|
||||
if (a.displayName < b.displayName) {
|
||||
return -1;
|
||||
}
|
||||
else if (a.name > b.name) {
|
||||
else if (a.displayName > b.displayName) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
|
@ -310,7 +310,7 @@ export default class TeamsCreator extends React.Component<ITeamsCreatorProps, IT
|
|||
/**
|
||||
* Main flow
|
||||
*/
|
||||
private async _processCreationRequest() {
|
||||
private async _processCreationRequest(): Promise<void> {
|
||||
const context = this.props.context;
|
||||
// initializing graph client to be used in all requests
|
||||
const graphClient = await context.msGraphClientFactory.getClient();
|
||||
|
@ -414,8 +414,8 @@ export default class TeamsCreator extends React.Component<ITeamsCreatorProps, IT
|
|||
*/
|
||||
private async _installApp(teamId: string, graphClient: MSGraphClient): Promise<boolean> {
|
||||
try {
|
||||
await graphClient.api(`teams/${teamId}/apps`).version('beta').post({
|
||||
id: this.state.selectedAppId
|
||||
await graphClient.api(`teams/${teamId}/installedApps`).version('v1.0').post({
|
||||
'teamsApp@odata.bind': `https://graph.microsoft.com/v1.0/appCatalogs/teamsApps/${this.state.selectedAppId}`
|
||||
});
|
||||
}
|
||||
catch (error) {
|
||||
|
@ -434,9 +434,9 @@ export default class TeamsCreator extends React.Component<ITeamsCreatorProps, IT
|
|||
*/
|
||||
private async _addTab(teamId: string, channelId: string, graphClient: MSGraphClient): Promise<boolean> {
|
||||
try {
|
||||
await graphClient.api(`teams/${teamId}/channels/${channelId}/tabs`).version('beta').post({
|
||||
name: this.state.tabName,
|
||||
teamsAppId: this.state.selectedAppId
|
||||
await graphClient.api(`teams/${teamId}/channels/${channelId}/tabs`).version('v1.0').post({
|
||||
displayName: this.state.tabName,
|
||||
'teamsApp@odata.bind': `https://graph.microsoft.com/v1.0/appCatalogs/teamsApps/${this.state.selectedAppId}`
|
||||
});
|
||||
}
|
||||
catch (error) {
|
||||
|
@ -459,7 +459,7 @@ export default class TeamsCreator extends React.Component<ITeamsCreatorProps, IT
|
|||
} = this.state;
|
||||
|
||||
try {
|
||||
const response = await graphClient.api(`teams/${teamId}/channels`).version('beta').post({
|
||||
const response = await graphClient.api(`teams/${teamId}/channels`).version('v1.0').post({
|
||||
displayName: channelName,
|
||||
description: channelDescription
|
||||
});
|
||||
|
@ -506,7 +506,7 @@ export default class TeamsCreator extends React.Component<ITeamsCreatorProps, IT
|
|||
});
|
||||
}
|
||||
try {
|
||||
const response = await graphClient.api('groups').version('beta').post(groupRequest);
|
||||
const response = await graphClient.api('groups').version('v1.0').post(groupRequest);
|
||||
return response.id;
|
||||
}
|
||||
catch (error) {
|
||||
|
@ -552,7 +552,7 @@ export default class TeamsCreator extends React.Component<ITeamsCreatorProps, IT
|
|||
private async _createTeam(groupId: string, graphClient: MSGraphClient): Promise<string> {
|
||||
return new Promise<string>(resolve => {
|
||||
setTimeout(() => {
|
||||
graphClient.api(`groups/${groupId}/team`).version('beta').put({
|
||||
graphClient.api(`groups/${groupId}/team`).version('v1.0').put({
|
||||
memberSettings: {
|
||||
allowCreateUpdateChannels: true
|
||||
},
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
{
|
||||
"rulesDirectory": [
|
||||
"tslint-microsoft-contrib"
|
||||
],
|
||||
"extends": "@microsoft/sp-tslint-rules/base-tslint.json",
|
||||
"rulesDirectory": [],
|
||||
"rules": {
|
||||
"class-name": false,
|
||||
"export-name": false,
|
||||
|
|
Loading…
Reference in New Issue