Data Providers
...
MS Graph
Graph User Profile
Get User Profile & Photo
6min
Gets a user's profile and photo in Microsoft Graph using functions, and displays the profile and photo on a using the image and entity component.
Resource links:
Required OAuth scope (least to most privilege):
User.Read User.ReadWrite User.ReadBasic.All User.Read.All User.ReadWrite.All Directory.Read.All Directory.ReadWrite.All
![User Profile User Profile](https://images.archbee.com/x7vdIDH6-ScTprfmi2XXX/dntkn6sc5sSZFqfHF7IGH_graph-user-profile.png?format=webp)
User Profile
index.jigx
name: ms-graph-demonstrator
title: MS Graph Demonstrator
description: A sample solution that uses the Microsoft Graph API. You can deploy and use this solution without any additional configuration.
category: business
widgets:
- size: 2x2 # choose size of the widget on the home hub
jigId: view-user-jigx
onFocus:
type: action.action-list
options:
isSequential: true
actions:
- type: action.sync-entities
options:
provider: DATA_PROVIDER_REST
entities:
- entity: user-profile
function: get-user-profile
functionParameters:
accessToken: microsoft.OAuth
- entity: profile-picture
function: get-profile-picture
functionParameters:
accessToken: microsoft.OAuth
userId: [email protected]
- entity: user-emails
function: get-user-emails-addresses
functionParameters:
accessToken: microsoft.OAuth
MS Graph User functions in GitHub.
get-user-profile.jigx
get-profile-picture.jigx
provider: DATA_PROVIDER_REST
method: GET
format: pdf #pdf indicates a generic binary type
url: https://graph.microsoft.com/v1.0/me/photo/$value
outputTransform: $.{"data":$.data,"userId":$.inputs.userId.value} #add the email input to the output to identify image later in select
parameters:
accessToken:
location: header
required: true
type: string
value: microsoft.OAuth #Use manage.jigx.com to define credentials for your solution
userId:
type: string
location: path
required: true
conversions:
- property: data
from: base64
to: local-uri
MS Graph User in GitHub.
view-user-jigx.jigx
title: View User Profile
description: Displays a user's profile information from Microsoft Graph
type: jig.default
icon: person
header:
type: component.jig-header
options:
height: small
children:
type: component.image
options:
source:
uri: https://support.content.office.net/en-us/media/f1c4b693-4670-4e7a-8102-bbf1749e83fe.jpg
onRefresh:
type: action.sync-entities
options:
provider: DATA_PROVIDER_REST
entities:
- entity: user-profile
function: get-user-profile
functionParameters:
accessToken: microsoft.OAuth
- entity: profile-picture
function: get-profile-picture
functionParameters:
accessToken: microsoft.OAuth
userId: [email protected]
- entity: user-emails
function: get-user-emails-addresses
functionParameters:
accessToken: microsoft.OAuth
datasources:
userProfile:
type: datasource.sqlite
options:
provider: DATA_PROVIDER_LOCAL
entities:
- entity: user-profile
query: |
SELECT id,
'$.displayName',
'$.givenName',
'$.jobTitle',
'$.mail',
'$.mobilePhone',
'$.officeLocation',
'$.surname',
'$.userPrincipalName',
'$.businessPhones',
'$.id'
FROM [user-profile]
isDocument: true
profilePhoto:
type: datasource.sqlite
options:
provider: DATA_PROVIDER_LOCAL
entities:
- entity: profile-picture
query: SELECT id, '$.userId', '$.data' FROM [profile-picture]
isDocument: true
userEmails:
type: datasource.sqlite
options:
provider: DATA_PROVIDER_LOCAL
entities:
- entity: user-emails
query: SELECT id, '$.address', '$.type', '$.allowedAudiences' FROM [user-emails]
children:
- type: component.image
options:
source:
uri: [email protected]
height: 200
resizeMode: contain
- type: component.entity
options:
children:
- type: component.entity-field
options:
label: Email
value: [email protected]
contentType: email
- type: component.entity-field
options:
label: User Principal Name
value: [email protected]
- type: component.entity-field
options:
label: Display Name
value: [email protected]
- type: component.field-row
options:
children:
- type: component.entity-field
options:
label: Given Name
value: [email protected]
- type: component.entity-field
options:
label: Surname
value: [email protected]
- type: component.field-row
options:
children:
- type: component.entity-field
options:
label: Job Title
value: [email protected]
- type: component.entity-field
options:
label: Mobile Phone
value: [email protected]
- type: component.entity-field
options:
label: Office Location
value: [email protected]
- type: component.section
options:
title: Email Addresses
children:
- type: component.list
options:
data: [email protected]
maximumItemsToRender: 8
item:
type: component.list-item
options:
divider: solid
leftElement:
element: icon
icon: email
title: [email protected]
subtitle: |
="Type: " & @ctx.current.item.type
description: |
="Allowed Audiences: " & @ctx.current.item.allowedAudiences
actions:
- children:
- type: action.go-to
options:
title: Update Profile Picture
linkTo: update-profile-picture
widgets:
"2x4":
type: widget.group
options:
children:
- type: widget.avatar
options:
text: "Your Profile"
uri: [email protected]
bottom:
type: component.titles
options:
align: center
title: [email protected]
subtitle: [email protected]
"2x2":
type: widget.image
options:
isContentOverlaid: true
source:
uri: [email protected]
bottom:
type: component.titles
options:
title: [email protected]
subtitle: [email protected]
Updated 06 May 2024
![Doc contributor](https://s3.amazonaws.com/archbee-animals/rabbit.png)
![Doc contributor](https://s3.amazonaws.com/archbee-animals/dog.png)
Did this page help you?