{
+ this.domElement.setAttribute("Id", `"${this._guid}"`);
+ this.domElement.setAttribute("class", `"${styles.sdk}"`);
+ const classColor = await this.getContext();
+ this.domElement.innerHTML = ``;
+
+ //
+ this._services = new service(this.context);
+ try {
+ const token: string = await this._services.getAccessToken();
+ const flowSDK = new this._msFlowSdk({
+ hostName: "https://flow.microsoft.com",
+ locale: this.context.pageContext.cultureInfo.currentCultureName
+ });
+ // Render Flow widget
+ let widget: any = flowSDK.renderWidget("flows", {
+ container: `"${this._guid}"`,
+ sdkVersion: "1.1",
+ enableOnBehalfOfTokens: true,
+ debugMode: false,
+ allowOptionalEvents: true,
+ flowsSettings: {
+ createFromBlankTemplateId: "05ed784f63df4ac7b8cbb465005d6068",
+ encodedFlowsFilter: "",
+ isMini: false,
+ enableBusinessProcessFlow: true
+ },
+ templatesSettings: {
+ defaultParams: "",
+ category: "PowerAppsButton",
+ destination: "new",
+ metadataSortProperty: "",
+ pageSize: 6,
+ searchTerm: "",
+ useServerSideProvisioning: false,
+ showGoBack: true,
+ enableWidgetCloseOnFlowSave: false,
+ showCreateFromBlank: false,
+ enableDietDesigner: false,
+ showHiddenTemplates: false,
+ allowCustomFlowName: false,
+ oneClickCategory: "",
+ dietCategory: ""
+ },
+ widgetStyleSettings: {
+ backgroundColor: "",
+ themeName: ""
+ }
+ });
+ // Register handler
+ widget.listen("GET_ACCESS_TOKEN", (requestParam, widgetDoneCallback) => {
+ widgetDoneCallback(null, { token: token });
+ });
+ // Register handler
+ widget.listen("WIDGET_READY", () => {
+ console.log("The flow widget is now ready.");
+ });
+ } catch (error) {
+ // error
+ this.domElement.innerHTML = `
+
+ `;
+ }
+ }
+
+ protected get dataVersion(): Version {
+ return Version.parse("1.0");
+ }
+
+ protected getPropertyPaneConfiguration(): IPropertyPaneConfiguration {
+ return {
+ pages: [
+ {
+ header: {
+ description: strings.PropertyPaneDescription
+ },
+ groups: [
+ {
+ groupName: strings.BasicGroupName,
+ groupFields: [
+ PropertyPaneTextField("title", {
+ label: strings.DescriptionFieldLabel
+ })
+ ]
+ }
+ ]
+ }
+ ]
+ };
+ }
+}
diff --git a/samples/js-myflows/src/webparts/myFlows/loc/en-us.js b/samples/js-myflows/src/webparts/myFlows/loc/en-us.js
new file mode 100644
index 000000000..84b54f053
--- /dev/null
+++ b/samples/js-myflows/src/webparts/myFlows/loc/en-us.js
@@ -0,0 +1,7 @@
+define([], function() {
+ return {
+ "PropertyPaneDescription": "Manage My Flows in SharePoint ",
+ "BasicGroupName": "Properties",
+ "DescriptionFieldLabel": "Title"
+ }
+});
diff --git a/samples/js-myflows/src/webparts/myFlows/loc/mystrings.d.ts b/samples/js-myflows/src/webparts/myFlows/loc/mystrings.d.ts
new file mode 100644
index 000000000..209e03af3
--- /dev/null
+++ b/samples/js-myflows/src/webparts/myFlows/loc/mystrings.d.ts
@@ -0,0 +1,10 @@
+declare interface IMyFlowsWebPartStrings {
+ PropertyPaneDescription: string;
+ BasicGroupName: string;
+ DescriptionFieldLabel: string;
+}
+
+declare module 'MyFlowsWebPartStrings' {
+ const strings: IMyFlowsWebPartStrings;
+ export = strings;
+}
diff --git a/samples/js-myflows/teams/69105900-a016-43cb-9e28-9a16bb92cb87_color.png b/samples/js-myflows/teams/69105900-a016-43cb-9e28-9a16bb92cb87_color.png
new file mode 100644
index 000000000..a8d279707
Binary files /dev/null and b/samples/js-myflows/teams/69105900-a016-43cb-9e28-9a16bb92cb87_color.png differ
diff --git a/samples/js-myflows/teams/69105900-a016-43cb-9e28-9a16bb92cb87_outline.png b/samples/js-myflows/teams/69105900-a016-43cb-9e28-9a16bb92cb87_outline.png
new file mode 100644
index 000000000..6df4a038d
Binary files /dev/null and b/samples/js-myflows/teams/69105900-a016-43cb-9e28-9a16bb92cb87_outline.png differ
diff --git a/samples/js-myflows/tsconfig.json b/samples/js-myflows/tsconfig.json
new file mode 100644
index 000000000..85a5981f0
--- /dev/null
+++ b/samples/js-myflows/tsconfig.json
@@ -0,0 +1,38 @@
+{
+ "extends": "./node_modules/@microsoft/rush-stack-compiler-2.9/includes/tsconfig-web.json",
+ "compilerOptions": {
+ "target": "es5",
+ "forceConsistentCasingInFileNames": true,
+ "module": "esnext",
+ "moduleResolution": "node",
+ "jsx": "react",
+ "declaration": true,
+ "sourceMap": true,
+ "experimentalDecorators": true,
+ "skipLibCheck": true,
+ "outDir": "lib",
+ "inlineSources": false,
+ "strictNullChecks": false,
+ "noUnusedLocals": false,
+ "typeRoots": [
+ "./node_modules/@types",
+ "./node_modules/@microsoft"
+ ],
+ "types": [
+ "es6-promise",
+ "webpack-env"
+ ],
+ "lib": [
+ "es5",
+ "dom",
+ "es2015.collection"
+ ]
+ },
+ "include": [
+ "src/**/*.ts"
+ ],
+ "exclude": [
+ "node_modules",
+ "lib"
+ ]
+}
diff --git a/samples/js-myflows/tslint.json b/samples/js-myflows/tslint.json
new file mode 100644
index 000000000..6bfc75a4c
--- /dev/null
+++ b/samples/js-myflows/tslint.json
@@ -0,0 +1,30 @@
+{
+ "extends": "@microsoft/sp-tslint-rules/base-tslint.json",
+ "rules": {
+ "class-name": false,
+ "export-name": false,
+ "forin": false,
+ "label-position": false,
+ "member-access": true,
+ "no-arg": false,
+ "no-console": false,
+ "no-construct": false,
+ "no-duplicate-variable": true,
+ "no-eval": false,
+ "no-function-expression": true,
+ "no-internal-module": true,
+ "no-shadowed-variable": true,
+ "no-switch-case-fall-through": true,
+ "no-unnecessary-semicolons": true,
+ "no-unused-expression": true,
+ "no-use-before-declare": true,
+ "no-with-statement": true,
+ "semicolon": true,
+ "trailing-comma": false,
+ "typedef": false,
+ "typedef-whitespace": false,
+ "use-named-parameter": true,
+ "variable-name": false,
+ "whitespace": false
+ }
+}
\ No newline at end of file
diff --git a/samples/react-directory/.prettierrc b/samples/react-directory/.prettierrc
new file mode 100644
index 000000000..cf1d46574
--- /dev/null
+++ b/samples/react-directory/.prettierrc
@@ -0,0 +1,6 @@
+{
+ "semi": true,
+ "singleQuote": true,
+ "trailingComma": "es5"
+
+}
diff --git a/samples/react-directory/src/SPServices/spservices.ts b/samples/react-directory/src/SPServices/spservices.ts
index 2f72828ef..c3cdbb7cd 100755
--- a/samples/react-directory/src/SPServices/spservices.ts
+++ b/samples/react-directory/src/SPServices/spservices.ts
@@ -2,6 +2,7 @@ import { WebPartContext } from "@microsoft/sp-webpart-base";
import { graph } from "@pnp/graph";
import { sp, PeoplePickerEntity, ClientPeoplePickerQueryParameters, SearchQuery, SearchResults, SearchProperty, SortDirection } from '@pnp/sp';
import { PrincipalType } from "@pnp/sp/src/sitegroups";
+import { isRelativeUrl } from "office-ui-fabric-react";
export class spservices {
@@ -67,6 +68,9 @@ user:string */
SortList: [{ "Property": "LastName", "Direction": SortDirection.Ascending }],
});
+
+
+
return users;
} catch (error) {
Promise.reject(error);
diff --git a/samples/react-directory/src/webparts/directory/components/Directory.tsx b/samples/react-directory/src/webparts/directory/components/Directory.tsx
index 20e3a97fd..a627dafc1 100755
--- a/samples/react-directory/src/webparts/directory/components/Directory.tsx
+++ b/samples/react-directory/src/webparts/directory/components/Directory.tsx
@@ -99,6 +99,33 @@ export default class Directory extends React.Component<
await this._searchUsers("A");
}
+ /**
+ * Gets image base64
+ * @param pictureUrl
+ * @returns
+ */
+ private getImageBase64(pictureUrl: string):Promise{
+ return new Promise((resolve, reject) => {
+ let image = new Image();
+ image.addEventListener("load", () => {
+ let tempCanvas = document.createElement("canvas");
+ tempCanvas.width = image.width,
+ tempCanvas.height = image.height,
+ tempCanvas.getContext("2d").drawImage(image, 0, 0);
+ let base64Str;
+ try {
+ base64Str = tempCanvas.toDataURL("image/png");
+ } catch (e) {
+ return "";
+ }
+
+ resolve(base64Str);
+ });
+ image.src = pictureUrl;
+ });
+}
+
+
private async _searchUsers(searchText: string) {
searchText = searchText.trim().length > 0 ? searchText : "A";
this.setState({
@@ -112,6 +139,17 @@ export default class Directory extends React.Component<
searchText,
this.props.searchFirstName
);
+
+ if (users && users.PrimarySearchResults.length > 0){
+ for (let index = 0; index < users.PrimarySearchResults.length; index++) {
+ let user:any = users.PrimarySearchResults[index] ;
+ if (user.PictureURL){
+ user = { ...user, PictureURL: await this.getImageBase64(`/_layouts/15/userphoto.aspx?size=M&accountname=${user.WorkEmail}`)};
+ users.PrimarySearchResults[index] = user ;
+ }
+ }
+ }
+
this.setState({
users:
users && users.PrimarySearchResults
diff --git a/samples/react-directory/src/webparts/directory/components/PersonaCard/PersonaCard.tsx b/samples/react-directory/src/webparts/directory/components/PersonaCard/PersonaCard.tsx
index d467ef11e..c7a009337 100755
--- a/samples/react-directory/src/webparts/directory/components/PersonaCard/PersonaCard.tsx
+++ b/samples/react-directory/src/webparts/directory/components/PersonaCard/PersonaCard.tsx
@@ -1,16 +1,16 @@
-import * as React from "react";
-import styles from "./PersonaCard.module.scss";
-import { IPersonaCardProps } from "./IPersonaCardProps";
-import { IPersonaCardState } from "./IPersonaCardState";
+import * as React from 'react';
+import styles from './PersonaCard.module.scss';
+import { IPersonaCardProps } from './IPersonaCardProps';
+import { IPersonaCardState } from './IPersonaCardState';
import {
Version,
Environment,
EnvironmentType,
ServiceScope,
Log,
- Text
-} from "@microsoft/sp-core-library";
-import { SPComponentLoader } from "@microsoft/sp-loader";
+ Text,
+} from '@microsoft/sp-core-library';
+import { SPComponentLoader } from '@microsoft/sp-loader';
import {
Persona,
@@ -22,13 +22,12 @@ import {
DocumentCard,
IDocumentCardStyles,
DocumentCardType,
- Icon
-} from "office-ui-fabric-react";
+ Icon,
+} from 'office-ui-fabric-react';
-const EXP_SOURCE: string = "SPFxDirectory";
+const EXP_SOURCE: string = 'SPFxDirectory';
const LIVE_PERSONA_COMPONENT_ID: string =
- "914330ee-2df2-4f6e-a858-30c23a812408";
-//const PROFILE_IMAGE_URL: string = 'https://outlook.office365.com/owa/service.svc/s/GetPersonaPhoto?email={0}&UA=0&size=HR96x96&sc=1564597822258';
+ '914330ee-2df2-4f6e-a858-30c23a812408';
export class PersonaCard extends React.Component<
IPersonaCardProps,
@@ -36,6 +35,7 @@ export class PersonaCard extends React.Component<
> {
constructor(props: IPersonaCardProps) {
super(props);
+
this.state = { livePersonaCard: undefined, pictureUrl: undefined };
}
/**
@@ -78,11 +78,11 @@ export class PersonaCard extends React.Component<
serviceScope: this.props.context.serviceScope,
upn: this.props.profileProperties.Email,
onCardOpen: () => {
- console.log("LivePersonaCard Open");
+ console.log('LivePersonaCard Open');
},
onCardClose: () => {
- console.log("LivePersonaCard Close");
- }
+ console.log('LivePersonaCard Close');
+ },
},
this._PersonaCard()
);
@@ -113,25 +113,25 @@ export class PersonaCard extends React.Component<
>
{this.props.profileProperties.WorkPhone ? (
-
-
- {" "}
+
+
+ {' '}
{this.props.profileProperties.WorkPhone}
) : (
- ""
+ ''
)}
{this.props.profileProperties.Location ? (
-
-
- {" "}
+
+
+ {' '}
{this.props.profileProperties.Location}
) : (
- ""
+ ''
)}
diff --git a/samples/react-manage-sitedesigns/config/package-solution.json b/samples/react-manage-sitedesigns/config/package-solution.json
index 03bd62921..3a4cf454b 100644
--- a/samples/react-manage-sitedesigns/config/package-solution.json
+++ b/samples/react-manage-sitedesigns/config/package-solution.json
@@ -6,7 +6,21 @@
"version": "1.0.0.0",
"includeClientSideAssets": true,
"skipFeatureDeployment": true,
- "isDomainIsolated": false
+ "isDomainIsolated": false,
+ "webApiPermissionRequests": [
+ {
+ "resource": "Microsoft Graph",
+ "scope": "User.Read.All"
+ },
+ {
+ "resource": "Microsoft Graph",
+ "scope": "Directory.Read.All"
+ },
+ {
+ "resource": "Microsoft Graph",
+ "scope": "Directory.AccessAsUser.All"
+ }
+ ]
},
"paths": {
"zippedPackage": "solution/react-manage-sitedesigns.sppkg"