How to quickly deploy PnP component to your demo tenant?

Before you want to develop anything on SPFx component (Webparts or Extensions) I suggest check out two following links on the PnP Open Source. Look/find for the component which meets your need “as is” or if you want to extend the component.

https://aka.ms/spfx-webparts & https://aka.ms/spfx-extensions

To research the inner working of the component you can follow few simple steps to deploy the desired component to your demo tenant.

Step # 1: Fork the PnP repository of WebPart or Extensions based on the need.

https://github.com/pnp/sp-dev-fx-webparts/ OR https://github.com/pnp/sp-dev-fx-extensions/

Step # 2: Please add the following two secret variables.

adminUsername = admin@{TENANTNAME].onmicrosoft.com
adminPassword = [your password]

Step # 3: In your new forked repository click on the Actions to create a new workflow. Copy the following content to the GitHub Actions YAML file.

https://raw.githubusercontent.com/pankajsurti/sp-dev-fx-webparts/master/.github/workflows/build-deploy-spfx-webparts.yml

Step # 4: Now look for the following line with the highlighted text and replace the sample name you want to deploy. e.g. the following setting will deploy ‘react-directory’.

SAMPLE_TO_BUILD_DEPLOY: './samples/react-directory'

Posted in Uncategorized | Leave a comment

SPFx CICD using GitHub Actions

Use following very simple steps to get SPFx web part or extensions to your tenant.

I recommend use the following two links to get any sample code.

#1 Lets assume you want to get the “js-application-alert-message“. Create a Git Hub Repo.

#2 Copy entire directory “js-application-alert-message” to a new location say ‘c:\demo\js-application-alert-message’ e.g.

xcopy react-application-festivals*.* c:\demo2\
js-application-alert-message
*.* /E /F

#3 Push the new directory with the code to the NEW GitHub repo using the following commands.

git init

git add *.*

git commit -m “first draft”

git remote add origin https://github.com/pankajsurti/react-application-festivals.git

git push -u origin master

#4 Now your source in the GitHub repo. It is time for creating two new secrets.

adminUsername (I used the admin@[TENANT_NAME].onmicrosoft.com)

adminPassword (password for the tenant)

on your repo click on “Settings” then click on the “Secrets”.

Add about two new secrets.

#5 Now it is time to add the GitHub Actions Workflow.

#6 Check the build and deploy is complete.

Posted in Uncategorized | Leave a comment

How to add a file to SPO using REST API?

Here the PowerShell code for it.

$url = ‘https://accounts.accesscontrol.windows.net/YOUR-TENANT-ID/tokens/OAuth/2′

$headers = @{
‘Content-Type’ = ‘application/x-www-form-urlencoded’
‘Accept’ = ‘*/*’
}
$client_Id = ‘YOUR-CLIENT-ID
$client_secrect = ‘YOUR-CLIENT-SECRET
$TenantID = ‘YOUR-TENANT-ID
$TenantName =’YOUR-TENANT-NAME
$body = $(“grant_type=client_credentials&client_id={0}%40{1}&client_secret={2}%3D&resource=00000003-0000-0ff1-ce00-000000000000%2F{3}.sharepoint.com%40{4}” -f $client_Id,$TenantID,$client_secrect,$TenantName,$TenantID)

$item = Invoke-WebRequest -Method POST -Uri $url -Headers $headers -Body $body -UseBasicParsing

$response = ConvertFrom-Json $item

$url=’https://YOUR-TENANT-NAME.sharepoint.com/sites/test123/_api/web/GetFolderByServerRelativePath(decodedurl=%27Shared Documents%27)/Files/add(url=%27NAME-OF_FILE.csv%27,overwrite=true)’

$headers = @{
‘Authorization’ = $(“{0} {1}” -f $response.token_type,$response.access_token)
‘Accept’ = ‘application/json; odata=verbose’
‘Content-Type’ = ‘text/csv’
}
$r = Get-Content C:\0-VA\NAME-OF_FILE.csv | `
Invoke-WebRequest -Method POST -Uri $url -Headers $headers -UseBasicParsing

Note: To get client id and secret use the following link.

http://www.ktskumar.com/2017/01/access-sharepoint-online-using-postman/

Posted in Uncategorized | Leave a comment

Governance, management and lifecycle in Microsoft Teams

Role Based Access Control
https://aka.ms/teams-rbac

Teams settings
https://aka.ms/teams-settings

Messaging policies
https://aka.ms/teams-messaging

Meeting settings
https://aka.ms/teams-meeting-settings

Meeting policies
https://aka.ms/teams-meeting-policies

Live events policies
https://aka.ms/teams-live-events

External access
https://aka.ms/teams-external-access

Guest access
https://aka.ms/guests-o365-groups

Ability to create teams
https://aka.ms/create-o365-groups

Classification for teams
https://aka.ms/teams-classification

Retention policies
https://aka.ms/teams-retention

Expiration policies
https://aka.ms/teams-expiration

PowerShell for Teams
https://aka.ms/teams-powershell

Graph API for Teams
https://aka.ms/teams-graph

Posted in Uncategorized | Leave a comment

Build 2020 Videos

SK100 Building modern enterprise-grade collaboration solutions with Microsoft Teams
https://aka.ms/M365SK100
SK101 Transform everyday business processes with Microsoft 365 platform integrations
https://aka.ms/M365SK101
SK102 What’s new with Microsoft Teams as a platform
https://aka.ms/M365SK102
SK106 Tips for Teams developers: Authentication and proactive messaging
https://aka.ms/M365SK106
SK107 Developing with the Fluid Framework
https://aka.ms/M365SK107
SK108 Microsoft Graph data and services – a deep dive for developers
https://aka.ms/M365SK108
SK109 A blueprint for building trustworthy apps that reach millions of users
https://aka.ms/M365SK109
SK110 What’s new with Microsoft Graph
https://aka.ms/M365SK110
SK111 Extend Microsoft 365 experiences with Graph Connectors
https://aka.ms/M365SK111
SK112 Transforming information to knowledge using Project Cortex
https://aka.ms/M365SK112
SK113 Use External Identities to build digital experiences for any user
https://aka.ms/M365SK113
SK114 Building trust into digital experiences with decentralized identities
https://aka.ms/M365SK114
https://aka.ms/opendid – Introducing Verifiable Credentials
https://github.com/decentralized-identity
SK115 Building apps for modern productivity with To Do in Microsoft Graph
https://aka.ms/M365SK115
SK116 Build richer people experiences with Profile API on Microsoft Graph
https://aka.ms/M365SK116
SK117 Smart meetings, room, places and event sync in Microsoft Graph
https://aka.ms/M365SK117
SK118 Add cloud-based printing to your application with Universal Print
https://aka.ms/M365SK118
SK119 React Native: Build cross platform apps that target Windows, Mac, and more!
https://aka.ms/M365SK119
SK120 Microsoft Edge DevTools for web developers
https://aka.ms/M365SK120
SK121 End-to-end web development with VS Code and Microsoft Edge
https://aka.ms/M365SK121
SK122 Building rich app experiences with Progressive Web Apps
https://aka.ms/M365SK122
SK123 How to bring your Android apps to Surface Duo with Xamarin
https://aka.ms/M365SK123
SK124 Application security and deployment [MSIX]
https://aka.ms/M365SK124
SK125 Foundation: Get started building modern Windows 10 apps
https://aka.ms/M365SK125
SK126 Harness the power of WebRTC in your Windows apps with the new WinRTC!
https://aka.ms/M365SK126
SK127 Building apps for 1 billion Windows 10 Desktops and expanding reach w/ Windows Virtual Desktop
https://aka.ms/M365SK127
SK128 WebView2: Bringing the best of the web to your native apps
https://aka.ms/M365SK128
SK129 Building Extensions for the new Microsoft Edge
https://aka.ms/M365SK129
SK130 Windows AI: hardware-accelerated ML on Windows devices
https://aka.ms/M365SK130
SK131 Fluent Design System – Building apps that feel natural on every device
https://aka.ms/M365SK131
SK133 Accessibility Insights: Open source accessibility testing tools
https://aka.ms/M365SK133
SK134 Adaptive Cards – The next gen of contextual user experiences in your apps and Microsoft 365
https://aka.ms/M365SK134
SK135 The Windows Command-Line: Windows Terminal & WSL 2
https://aka.ms/M365SK135
SK136 Foundation: Windows 10 – features and tools for all developers
https://aka.ms/M365SK136
SK137 Surface Book 3 – GPU-accelerated application development
https://aka.ms/M365SK137

Posted in Uncategorized | Leave a comment

REST API for SPO using Postman

I have created a Postman collection to Access SPO using REST API.

https://github.com/pankajsurti/Access-SharePoint-Online-using-Postman

More details are here

http://www.ktskumar.com/2017/01/access-sharepoint-online-using-postman/

Posted in Uncategorized | Leave a comment

Download JSON data Cross Browser Support specially IE

My customer has a need to provide download links for underlying data of Power BI Embedded report. The embedding worked is all worked fine on the public site page. We also provided the download links to download underlying data in CSV and JSON format. All worked fine but the download links did not work in IE11. After searching on web found this article which was so helpful and worked with no issues.

Download JSON data in CSV format Cross Browser Support -> https://ciphertrick.com/download-json-data-in-csv-format-cross-browser-support/

I will not repeat what is discussed in the above blog. However my need was to support JSON format file download as well. So I used the following code as shown in the blog.

IEwindow.document.execCommand(‘SaveAs’, true, fileName + “.json”);

The issue is that the file type .json was not liked by IE so it never saved this file. I am guessing something to do with the code as a JSON file. To save you the trouble please DO NOT use .json instead use something like this.

IEwindow.document.execCommand(‘SaveAs’, true, fileName + “.json.TXT“);

That line was OK for IE and it worked like a charm. I hope it is helpful to you.

 

Posted in Uncategorized | Leave a comment

Download Power BI visual data as CSV or JSON

My customer had a requirement to download the Summary data of the report visual for Power BI embedded report.

I went to achieve this as a wrong path first. I hope you don’t do the same mistake.

The path I first took was to use the REST API below.
Datasets – Get Dataset -> https://docs.microsoft.com/en-us/rest/api/power-bi/datasets/getdataset

Push Datasets – Datasets GetTables -> https://docs.microsoft.com/en-us/rest/api/power-bi/pushdatasets/datasets_gettables

DO NOT use those APIs to get the dataset of an existing report. This will not work. These APIs only work for the data you pushed via API. The data set will show the API ACCESS as shown below.

PowerBIAPIAccess To download embedded report data use the Power BI client JS api to download.

Export Data-> https://github.com/microsoft/PowerBI-JavaScript/wiki/Export-Data

 

Posted in Uncategorized | Leave a comment

Getting Group owners using MS Graph API in Power Automate

The call is made using the MS Graph API call.

https://docs.microsoft.com/en-us/graph/api/group-list-owners?view=graph-rest-1.0&tabs=http

Q:How does the MS Graph API work?

A: The following are the steps.

  1. Register an Azure AD app with the following API permission granted and consented.
Microsoft Graph (2)
     - Group.Read.All
     - User.Read.All

2. Using the REST API to get the Access Token.

POST https://login.microsoftonline.com/<<<Guid for tenant>>>/oauth2/v2.0/token

REQUEST BODY:

grant_type=client_credentials&client_id=<<Azure AD App ID>>&client_secret=<<<the secret>>> &scope=https%3A%2F%2Fgraph.microsoft.com%2F.default

RESPONSE BODY:

{

“token_type”: “Bearer”,

“expires_in”: 3599,

“ext_expires_in”: 3599,

“access_token”: “<<blah blah long string>>”

}

  1. Using the above access token make a call to get the owners.

GET https://graph.microsoft.com/v1.0/groups/<<GuidforGroup>>/owners

It will give the data response as the following.

{

"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#directoryObjects",
"value": [
{
"@odata.type": "#microsoft.graph.user",
"id": "12d7bb75-763b-4103-a367-e6fa9ca0edaa",
"businessPhones": [
   "8005555555"
],
"displayName": "MOD Administrator",
"givenName": "MOD",
"jobTitle": null,
"mail": "admin@TenantName.OnMicrosoft.com",
"mobilePhone": "555-555-5555",
"officeLocation": null,
"preferredLanguage": "en-US",
"surname": "Administrator",
"userPrincipalName": "admin@TanantName.onmicrosoft.com"
}
]
}

Q: How to make such calls from Power Automate?

A: Here is the answer in the link below.

https://www.infopulse.com/blog/using-microsoft-graph-api-inside-microsoft-flow-office-365/

Posted in Uncategorized | Leave a comment

Microsoft Graph Security API

I have been working on the Microsoft Security Graph API to get the reports.
I have created a PostMan collection put it on the GitHub Repo.

https://github.com/pankajsurti/MicrosoftGraphSecurityAPIPostMan 

I have found following articles very useful.

https://aka.ms/GraphSecurityDocs

https://aka.ms/GraphSecurityAPICode

https://aka.ms/GraphSecuritySolutionsConnectors

https://aka.ms/GraphSecurityWhitePaperSevenWays

https://aka.ms/GraphSecurityQuickStarts

https://aka.ms/GraphSecuritySDK

https://aka.ms/GraphSecurityConnectorsBlogPost

https://aka.ms/GraphSecurityPowerBIConnectorBlogPost

https://aka.ms/GraphSecurityPowerShellModulePost

https://aka.ms/GraphSecurityCuratedQueries

https://aka.ms/GraphSecurityJupyterNotebooks

https://github.com/Microsoft/MicrosoftGraphSecurity

Five cool security apps you can build using Microsoft Graph | BRK3073
https://www.youtube.com/watch?v=Klc9z7jbQio

 

Posted in Uncategorized | Leave a comment