Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added GenericCard-Graph-UserManager #173

Merged
merged 1 commit into from
Mar 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
352 changes: 352 additions & 0 deletions samples/GenericCard-Graph-UserManager/.eslintrc.js

Large diffs are not rendered by default.

34 changes: 34 additions & 0 deletions samples/GenericCard-Graph-UserManager/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Logs
logs
*.log
npm-debug.log*

# Dependency directories
node_modules

# Build generated files
dist
lib
release
solution
temp
*.sppkg
.heft

# Coverage directory used by tools like istanbul
coverage

# OSX
.DS_Store

# Visual Studio files
.ntvs_analysis.dat
.vs
bin
obj

# Resx Generated Code
*.resx.ts

# Styles Generated Code
*.scss.ts
16 changes: 16 additions & 0 deletions samples/GenericCard-Graph-UserManager/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
!dist
config

gulpfile.js

release
src
temp

tsconfig.json
tslint.json

*.log

.yo-rc.json
.vscode
1 change: 1 addition & 0 deletions samples/GenericCard-Graph-UserManager/.nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v18.17.1
24 changes: 24 additions & 0 deletions samples/GenericCard-Graph-UserManager/.yo-rc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"@microsoft/generator-sharepoint": {
"whichFolder": "subdir",
"solutionName": "UserManager",
"componentType": "adaptiveCardExtension",
"aceTemplateType": "Generic",
"componentName": "UserManager",
"plusBeta": false,
"isCreatingSolution": true,
"nodeVersion": "18.17.1",
"sdksVersions": {
"@microsoft/microsoft-graph-client": "3.0.2",
"@microsoft/teams-js": "2.12.0"
},
"version": "1.18.2",
"libraryName": "user-manager",
"libraryId": "cde3458c-4caa-4395-80bd-625b1a41e624",
"environment": "spo",
"packageManager": "npm",
"solutionShortDescription": "UserManager description",
"skipFeatureDeployment": true,
"isDomainIsolated": false
}
}
64 changes: 64 additions & 0 deletions samples/GenericCard-Graph-UserManager/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# User Manager ACE

## Summary

This Adaptive Card Extension (ACE) shows the manager of the currently logged in user.

![alt text](assets/Card.png)
![alt text](assets/CardWithoutPicture.png)
![alt text](assets/ErrorCard.png)

## Used SharePoint Framework Version

![version](https://img.shields.io/badge/version-1.18.2-green.svg)

## Applies to

- [SharePoint Framework](https://aka.ms/spfx)
- [Microsoft 365 tenant](https://docs.microsoft.com/en-us/sharepoint/dev/spfx/set-up-your-developer-tenant)

> Get your own free development tenant by subscribing to [Microsoft 365 developer program](http://aka.ms/o365devprogram)

## Solution

| Solution | Author(s) |
| ----------- | ------------------------------------------------------- |
| UserManager | [guidozam](https://github.com/guidozam) |

## Version history

| Version | Date | Comments |
| ------- | ---------------- | --------------- |
| 1.0 | March 09, 2024 | Initial commit |

## 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.**

---

## Minimal Path to Awesome

- Clone this repository
- Ensure that you are at the solution folder
- in the command-line run:
- **npm install**
- **gulp serve**

## Features

This Adaptive Card Extension (ACE) shows the manager of the currently logged in user. It uses the Microsoft Graph to get the manager of the user and then displays it.
The displayed informations, where available, are:
- display name
- job title
- business phone number
- office location

If the manager does not have a picture the card will display a default picture.

If there is a problem getting the manager's information the card will display an error.

## References

- [Getting started with SharePoint Framework](https://docs.microsoft.com/en-us/sharepoint/dev/spfx/set-up-your-developer-tenant)
- [Use Microsoft Graph in your solution](https://docs.microsoft.com/en-us/sharepoint/dev/spfx/web-parts/get-started/using-microsoft-graph-apis)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
76 changes: 76 additions & 0 deletions samples/GenericCard-Graph-UserManager/assets/sample.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
[
{
"name": "user-manager",
"source": "pnp",
"title": "User Manager ACE",
"shortDescription": "This Adaptive Card Extension (ACE) shows the manager of the currently logged in user.",
"url": "https://github.com/pnp/sp-dev-fx-aces/tree/main/samples/GenericCard-Graph-UserManager",
"longDescription": [
"This Adaptive Card Extension (ACE) shows the manager of the currently logged in user. It uses the Microsoft Graph to get the manager of the user and then displays it."
],
"creationDateTime": "2024-03-09",
"updateDateTime": "2024-03-09",
"products": ["SharePoint", "Viva"],
"metadata": [
{
"key": "CLIENT-SIDE-DEV",
"value": "React"
},
{
"key": "SPFX-VERSION",
"value": "1.18.2"
}
],
"thumbnails": [
{
"type": "image",
"order": 100,
"url": "https://raw.github.com/pnp/sp-dev-fx-aces/main/samples/GenericCard-Graph-UserManager/assets/Card.png",
"alt": "Image of the card with all the manager informations"
},
{
"type": "image",
"order": 200,
"url": "https://raw.github.com/pnp/sp-dev-fx-aces/main/samples/GenericCard-Graph-UserManager/assets/CardWithoutPicture.png",
"alt": "Image of the card with some informations and no picture"
},
{
"type": "image",
"order": 300,
"url": "https://raw.github.com/pnp/sp-dev-fx-aces/main/samples/GenericCard-Graph-UserManager/assets/ErrorCard.png",
"alt": "Image of the card when an error occurs"
}
],
"authors": [
{
"gitHubAccount": "GuidoZam",
"company": "PiaSys.com",
"pictureUrl": "https://github.com/guidozam.png",
"name": "Guido Zambarda",
"twitter": "iamguidozam"
}
],
"references": [
{
"name": "Getting started with SharePoint Framework",
"description": "Learn how to start developing SharePoint Framework solutions.",
"url": "https://docs.microsoft.com/en-us/sharepoint/dev/spfx/set-up-your-developer-tenant"
},
{
"name": "Viva Connections Extensibility guidance",
"description": "Adaptive Card Extensions are client-side components that run in the context of a SharePoint page.",
"url": "https://aka.ms/viva/connections/extensibility"
},
{
"name": "Designing Viva Connections custom cards for your dashboard",
"description": "Official guidelines about how to design the Card Views of a SharePoint Framework Adaptive Card Extension (ACE).",
"url": "https://learn.microsoft.com/en-us/sharepoint/dev/spfx/viva/design/designing-card"
},
{
"name": "Microsoft 365 Patterns and Practices",
"description": "Guidance, tooling, samples and open-source controls for your Microsoft 365 development.",
"url": "https://aka.ms/m365pnp"
}
]
}
]
18 changes: 18 additions & 0 deletions samples/GenericCard-Graph-UserManager/config/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/config.2.0.schema.json",
"version": "2.0",
"bundles": {
"user-manager-adaptive-card-extension": {
"components": [
{
"entrypoint": "./lib/adaptiveCardExtensions/userManager/UserManagerAdaptiveCardExtension.js",
"manifest": "./src/adaptiveCardExtensions/userManager/UserManagerAdaptiveCardExtension.manifest.json"
}
]
}
},
"externals": {},
"localizedResources": {
"UserManagerAdaptiveCardExtensionStrings": "lib/adaptiveCardExtensions/userManager/loc/{locale}.js"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/deploy-azure-storage.schema.json",
"workingDir": "./release/assets/",
"account": "<!-- STORAGE ACCOUNT NAME -->",
"container": "user-manager",
"accessKey": "<!-- ACCESS KEY -->"
}
40 changes: 40 additions & 0 deletions samples/GenericCard-Graph-UserManager/config/package-solution.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/package-solution.schema.json",
"solution": {
"name": "user-manager-client-side-solution",
"id": "cde3458c-4caa-4395-80bd-625b1a41e624",
"version": "1.0.0.0",
"includeClientSideAssets": true,
"skipFeatureDeployment": true,
"isDomainIsolated": false,
"developer": {
"name": "",
"websiteUrl": "",
"privacyUrl": "",
"termsOfUseUrl": "",
"mpnId": "Undefined-1.18.2"
},
"metadata": {
"shortDescription": {
"default": "UserManager description"
},
"longDescription": {
"default": "UserManager description"
},
"screenshotPaths": [],
"videoUrl": "",
"categories": []
},
"features": [
{
"title": "user-manager Feature",
"description": "The feature that activates elements of the user-manager solution.",
"id": "7962e482-e693-4ba3-8c58-0f643eb3643f",
"version": "1.0.0.0"
}
]
},
"paths": {
"zippedPackage": "solution/user-manager.sppkg"
}
}
3 changes: 3 additions & 0 deletions samples/GenericCard-Graph-UserManager/config/sass.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/core-build/sass.schema.json"
}
6 changes: 6 additions & 0 deletions samples/GenericCard-Graph-UserManager/config/serve.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/spfx-serve.schema.json",
"port": 4321,
"https": true,
"initialPage": "https://{tenantDomain}/_layouts/workbench.aspx"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/write-manifests.schema.json",
"cdnBasePath": "<!-- PATH TO CDN -->"
}
16 changes: 16 additions & 0 deletions samples/GenericCard-Graph-UserManager/gulpfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
'use strict';

const build = require('@microsoft/sp-build-web');

build.addSuppression(`Warning - [sass] The local CSS class 'ms-Grid' is not camelCase and will not be type-safe.`);

var getTasks = build.rig.getTasks;
build.rig.getTasks = function () {
var result = getTasks.call(build.rig);

result.set('serve', result.get('serve-deprecated'));

return result;
};

build.initialize(require('gulp'));
Loading
Loading