Use Microsoft Graph in SharePoint Development Framework (SPFx) – Let’s Learn a M365 topic vlog 9

In this video I explain how to use Microsoft Graph in SharePoint Development Framework (SPFx) to show Microsoft Teams information such as ID and Display name of user who is logged in.

Subscribe to my YouTube Channel https://www.youtube.com/channel/UC6vLzWN-3aFG8dgTgEOlx5g if this helped you , to appreciate my work and keep me motivated.

It uses NoJavaScript Framework. Source code is available here: https://github.com/sinhakislay/SPFxMi…

Video covers following:

1. Demo of the App

2. Prerequisites

3. Simple steps – Node.js console

4. Code overview

  • Simple Steps – Node.js console
  • Create a folder – md spfx-graphAPI
  • Get to the folder – cd spfx-graphAPI
  • Use Yeoman SharePoint Framework Generator
  • Answer question as below – yo @microsoft/sharepoint
  • What is your solution name?: spfx-graphAPI
  • Do you want to allow the tenant admin the choice of being able to deploy the solution to all sites immediately without running any feature deployment or adding apps in sites?: Yes
  • Which type of client-side component to create?: WebPart
  • What is your Web part name?: SP Graph API
  • Which framework would you like to use?: No JavaScript framework
  • Use Microsoft Graph type declarations – npm install @microsoft/microsoft-graph-types

#spfx #microsoftgraph #sharepointdevelopment #development #SharePoint

Explains how to use Microsoft Graph in SharePoint Development Framework

This extension illustrates the following concepts:

  • Call Microsoft Graph from SPFx App
  • Capture Microsoft Teams details
  • Display infomation

Connect with me on Twitter or Linked In and follow YouTube Channel or my blog 

https://www.linkedin.com/in/kislaysinha

https://www.youtube.com/channel/UC6vL…

Last week in Microsoft 365 – 19 Nov – 25 Nov 2020 – VLog 7

Subscribe to my YouTube Channel https://www.youtube.com/channel/UC6vLzWN-3aFG8dgTgEOlx5g if this helped you , to appreciate my work and keep me motivated.

n this 7th video of the series I discuss following topics:

1. Adding OOTB/Default Modern SPFx webparts to classic pages – Ram Prasad https://www.youtube.com/watch?v=tA3SX…

2. Handle your errors in Power Automate – Matt Weston https://www.youtube.com/watch?v=CvSZE…

3. Open an HTML file from Power Apps and host it within your solution – Terho Antila https://terhoantila.com/post/63538443… https://twitter.com/terhoantila

4. Configure the List form https://docs.microsoft.com/en-gb/shar…

5. New Bookings experience and capabilities help streamline scheduling – Jessica Wilczek https://techcommunity.microsoft.com/t…

#SharePoint #ListForms #PowerApps #PowerAutomate #MicrosoftBookings

YouTube Playlist

Connect with me on Twitter or Linked In and follow YouTube Channel or my blog 

https://www.linkedin.com/in/kislaysinha

https://www.youtube.com/channel/UC6vL…

Last week in Microsoft 365 – 26 Nov – 02 Dec 2020 – VLog 8

Subscribe to my YouTube Channel https://www.youtube.com/channel/UC6vLzWN-3aFG8dgTgEOlx5g if this helped you , to appreciate my work and keep me motivated.

In this video I talk about 5 topics

1. Launch of Festive Tech Calendar Follow Cloud Family and festivetechcalendar.com for new videos all December. there will be one video from my side as well https://twitter.com/_CloudFamily/stat… https://festivetechcalendar.com

2. Create single sign-on authentication for tab apps with Microsoft Teams Toolkit for Visual Studio Code https://developer.microsoft.com/en-us… Teams Toolkit First look: https://www.youtube.com/watch?v=Yfi0D…

3. Self-service Microsoft Form for external guests to use Power App – John Liu Great blog from John Liu for a practical situation that is adding a a guest user of Power App to Tenant http://johnliu.net/blog/2020/11/self-…

4. 6 Power BI Reports for Microsoft Teams Call Quality Dashboard (CQD) – Tom Arbuthnot Nice description from Tom about Power BI reports from Teams Call Quality Dashboard https://tomtalks.blog/2020/02/6-power…

5. Use the Page Diagnostics for SharePoint tool https://docs.microsoft.com/en-us/micr…

#Festivetechcalendar #SSO #MicrosoftTeams #Teams #Power App #Microsoft Form #Diagnostic Tool #Dashboard

YouTube Playlist

Connect with me on Twitter or Linked In and follow YouTube Channel or my blog 

https://www.linkedin.com/in/kislaysinha

https://www.youtube.com/channel/UC6vL…

Last week in Microsoft 365 – 03 Dec – 09 Dec 2020 – VLog 10

Subscribe to my YouTube Channel https://www.youtube.com/channel/UC6vLzWN-3aFG8dgTgEOlx5g if this helped you , to appreciate my work and keep me motivated.

In this video I talk / highlight five topics from Microsoft 365

1. Free Microsoft Certification Renewals: Christmas came early as Microsoft as how you can renew your Microsoft Certifications from next year Feb 2021, more details here: https://techcommunity.microsoft.com/t…

2. Microsoft Teams: List all Teams, Team Members and Team Channels – Patrick Gruenauer A simple PowerShell script from Patrick where he explains how to get all Teams, Onwers and users, more information here https://sid-500.com/2020/12/14/micros…

3. Import SharePoint to Dataverse for Teams with Power Automate – Shane Young: A great video from Shane Young where he explains in very detail how to copy data from SharePoint to Dataverse using Power Automate, this is a very practical scernario which I think we gonna use a lot in future, more information here: https://www.youtube.com/watch?v=mvWLm…

4. New ways to connect SharePoint to Microsoft Teams Great improvements from Microsoft around SharePoint connection in Microsoft Teams, more information here: https://techcommunity.microsoft.com/t…

5. Announcing public preview of the Microsoft Teams Activity Feed API on Microsoft Graph, more information here: https://developer.microsoft.com/en-us… #Microsoft #MicrosoftGraph

#PowerAutomate #MicrosoftTeams #SharePoint #Dataverse #PowerShell #MicrosoftCertifications

YouTube Playlist

Connect with me on Twitter or Linked In and follow YouTube Channel or my blog 

https://www.linkedin.com/in/kislaysinha

https://synkventures.com

https://www.youtube.com/channel/UC6vL…

Last week in Microsoft 365 – 05 Nov – 11 Nov 2020 – VLog 5

Subscribe to my YouTube Channel https://www.youtube.com/channel/UC6vLzWN-3aFG8dgTgEOlx5g

In this VLog I have covered following topics

  • Use Microsoft Graph Toolkit with React
  • Patch SharePoint Choices columns in Power Apps  – Matthew Devaney
  • Me Experience in Microsoft Teams using Graph ToolKit and SPFx – Rabia Williams
  • Announcing general availability of Microsoft Teams Resource-specific consent and read channel messages – Microsoft 365 Dev team
  • How to record 1:1 Teams and PSTN calls with OBS Studio for free – Luca Vitali

Transcript of the video:

Hello and welcome all to series “Last week in Microsoft 365”, this is the fifth video in this series in and we have 5 topics to be highlighted this week which I liked.

1. Use Microsoft Graph Toolkit with React : The shared documentation explains how to create Apps using React and Microsoft Graph Tool kit. I have also done a YouTube video on this which you can refer here: https://www.youtube.com/watch?v=2qVL8mWux-4&t

Links: https://docs.microsoft.com/en-gb/grap…

2. Patch SharePoint Choices columns in Power Apps – Matthew Devaney : In this Matthew explains how to use Patch functionality, recently Reza Dorrani also did a video on this topic in which he also referred to Matthew’s blog, refer the video here https://www.youtube.com/watch?v=VzrarcM9W5k&feature=youtu.be

Links: https://twitter.com/mattbdevaney/stat… https://matthewdevaney.com/power-apps…

3. Me Experience in Microsoft Teams using Graph ToolKit and SPFx – Rabia Williams : In this Rabia explains how you can create Microsoft Teams Me experience which is quite unique explains all kind of possibilities we have using Microsofy Graph Toolkit

Links: https://rabiawilliams.com/teams/me-ex…

4. Announcing general availability of Microsoft Teams Resource-specific consent and read channel messages – Microsoft 365 Dev team

Links: https://developer.microsoft.com/en-us…

5. How to record 1:1 Teams and PSTN calls with OBS Studio for free – Luca Vitali

This is a great article bu Luca to explain how to use OBS Studio to record 1:1 Teams and PSTN calls.

Links: https://lucavitali.wordpress.com/2020…

Episode 1 Link: https://www.youtube.com/watch?v=4Mteq…

Episode 2 Link: https://www.youtube.com/watch?v=811h7jrqYlg&t=127s&ab_channel=SYNKVentures-Let%27stalkMicrosoft365

Episode 3 Link: https://www.youtube.com/watch?v=SQXjobuVCqY&t

Episode 4 Link: https://www.youtube.com/watch?v=4jnEvy9a-hk

Connect with me on Twitter or Linked In and follow YouTube Channel or my blog 

https://www.linkedin.com/in/kislaysinha

https://synkventures.com

https://www.youtube.com/channel/UC6vL…

Upload data from Excel in SharePoint using C#

There are many ways to upload data from excel in SharePoint. We can divide them in two categories

  1. SharePoint on premise: There is a good article which describes what are the ways available without any programming you can refer to it here: https://sharepointmaven.com/3-ways-import-excel-sharepoint/ . There are challenges in these methods, the biggest is that it does not allow all Column Types such as Metadata , Choice etc. Out of three explained there Import from excel is best but it will not allow Metadata column to be created
  2. SharePoint Online: Recently in SharePoint Online native support has been provided by Microsoft on uploading data from excel to SharePoint, there are few limitations but it works pretty well, you can refer to this article which has great details https://sharepointmaven.com/how-to-import-an-excel-spreadsheet-to-a-sharepoint-custom-list/

My blog talks about how you can use C# to upload data from excel to SharePoint.

Step 1: Read data from excel in C#: To do this the code is very simple but you need to have excel installed on the machine you are running the code.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Office.Interop.Excel; 

//Instantiate excel app and if not installed give a message
Application excelApp = new Application();
            if (excelApp == null)
            {
                Console.WriteLine("Excel is not installed!!");
                return;
            }

//load the workbook from where data needs to be read           
 Workbook excelBook = excelApp.Workbooks.Open(@"path of excel file including file name");
            _Worksheet excelSheet = excelBook.Sheets[1];
            Range excelRange = excelSheet.UsedRange;

            //get the number of rows and columns
            int rows = excelRange.Rows.Count;
            int cols = excelRange.Columns.Count;


//loop through them and print
            for (int i = 1; i <= rows; i++)
            { 
               for (int j = 1; j <= cols; j++)
               {

                //write the console
                if (excelRange.Cells[i, j] != null && excelRange.Cells[i, j].Value2 != null)
                {
                    Console.Write(excelRange.Cells[i, j].Value2.ToString() + "\t");

               }
}



Step 2: Add data to SharePoint list: Note that there are different column types supported by SharePoint but my main focus area is to how to insert data in column type Choice, Number, Metadata, Multi line text

 string siteUrl = "site url where data needs to be uploaded"
//create a context 
 ClientContext clientContext = new ClientContext(siteUrl);
//get the list in which data needs to be inserted
 Microsoft.SharePoint.Client.List list = clientContext.Web.Lists.GetByTitle("name of the list");
 //preparing list item which will be added                                                                                                
ListItemCreationInformation itemInfo = new ListItemCreationInformation();
ListItem listItemCreation = list.AddItem(itemInfo);

//this is needed for taxonomy / metadata field
 var taxonomySession = TaxonomySession.GetTaxonomySession(clientContext);
 var termStore = taxonomySession.GetDefaultSiteCollectionTermStore();

Once above is done we have to combine both so rest of the insert data code will be under 2nd for loop in read excel data part. Here we will assume that 1st column is a number, 2nd column a multi line text, 3rd a Taxonomy / Managed Metadata column, fourth a number column and fifth a choice column, please check the complete code below

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Office.Interop.Excel;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Client;
using Microsoft.SharePoint.Client.Taxonomy;
using System.Net.NetworkInformation;
using System.IO;
using System.Net;

namespace UploadDatatoSPfromExcel
{
    class Program
    {



        static void Main(string[] args)
        {

string siteUrl = "site url where data needs to be uploaded"
//create a context 
 ClientContext clientContext = new ClientContext(siteUrl);
//get the list in which data needs to be inserted
 Microsoft.SharePoint.Client.List list = clientContext.Web.Lists.GetByTitle("name of the list");
 //preparing list item which will be added                                                                                                
ListItemCreationInformation itemInfo = new ListItemCreationInformation();
ListItem listItemCreation = list.AddItem(itemInfo);

//this is needed for taxonomy / metadata field
 var taxonomySession = TaxonomySession.GetTaxonomySession(clientContext);
 var termStore = taxonomySession.GetDefaultSiteCollectionTermStore();
//Instantiate excel app and if not installed give a message
Application excelApp = new Application();
            if (excelApp == null)
            {
                Console.WriteLine("Excel is not installed!!");
                return;
            }

//load the workbook from where data needs to be read           
 Workbook excelBook = excelApp.Workbooks.Open(@"path of excel file including file name");
            _Worksheet excelSheet = excelBook.Sheets[1];
            Range excelRange = excelSheet.UsedRange;

            //get the number of rows and columns
            int rows = excelRange.Rows.Count;
            int cols = excelRange.Columns.Count;


//loop through them and print
            for (int i = 1; i <= rows; i++)
            { 

//we have to define field / column name for each column in which data will //be inserted, note that each name should be internal name of SharePoint //column

string fieldNameNumber = "FieldNumber";
string fieldNameMultiLineText = "FieldMultilineText";
string fieldNameTaxonomy = "FieldTaxonmy";
string fieldNameNumber = "FieldNumber";
string fieldNameChoice = "FieldChoice"



               for (int j = 1; j <= cols; j++)
               {

                //write the console
                if (excelRange.Cells[i, j] != null && excelRange.Cells[i, j].Value2 != null)
                {
                    Console.Write(excelRange.Cells[i, j].Value2.ToString() + "\t");

//I am skipping first row as it contains column name
if (j == 1 && i!=1)
                    {

//setting number column                  
      listItemCreation [fieldNameNumber ] = excelRange.Cells[i, j].Value2.ToString();

                    }

if (j == 2 && i!=1)
                    {

//setting multi line text column                  
      listItemCreation [fieldNameMultiLineText] = excelRange.Cells[i, j].Value2.ToString();

                    }

if (j == 3 && i!=1)
                    {

//setting fieldNameTaxonomy  column                  
      string fieldTaxonomyValue = excelRange.Cells[i, j].Value2.ToString();
//create variable to store GUID value of metadata      
Guid CustomertermIdGuid = Guid.Empty;
//Important to set correct term set name here
var allTerms = termStore.GetTermSetsByName("<<name of term set>>", 1033);
var termSet = allTerms.GetByName("<<name of term set>>");
                        
var terms = termSet.GetAllTerms();
                        clientContext.Load(terms, includes => includes.Include(k => k.Id, k => k.Name, k => k.Parent, k => k.Parent.Id, k => k.Parent.Name, k => k.IsRoot, k => k.LocalCustomProperties));
                        clientContext.ExecuteQuery();
                        foreach (var term in terms)
                        {
                            if (term.Name == Customer)
                            {
                                CustomertermIdGuid = term.Id;
                            }


                        }


                        fieldTaxonomyValue = Customer + '|' + CustomertermIdGuid.ToString();
                        

                    }

if (j == 4 && i!=1)
                    {

//setting number column                  
      listItemCreation [fieldNameNumber] = excelRange.Cells[i, j].Value2.ToString();

                    }

if (j == 5 && i!=1)
                    {

//setting chpice column                  
      listItemCreation [fieldNameChoice] = excelRange.Cells[i, j].Value2.ToString();

//since this is the last column we should insert value in SharePoint as well

            listItemCreation.Update();
            clientContext.Load(listItemCreation);
            clientContext.ExecuteQuery();

                    }

               }
}









        } 
   } 

}

Important point to note is how I have set the Managed Metadata column, first we we need to get all terms from term set and then find correct GUID else it will not work.

Code is not structured very well but you can refer main parts to write your own code.

Subscribe to my YouTube Channel https://www.youtube.com/channel/UC6vLzWN-3aFG8dgTgEOlx5g

Connect with me on Twitter or Linked In and follow YouTube Channel or my blog https://twitter.com/SinhaKislay

https://www.linkedin.com/in/kislaysinha

/https://synkventures.com

/https://www.youtube.com/channel/UC6vL…

Add Choice column in SharePoint list or library using PnP PowerShell

If you have not used PnP PowerShell you should use it, it is much easier to do tasks in PnP PowerShell.

Example: If you want to add a Choice column in SharePoint list or library.

Just few lines of code will do this and you don’t need to be on SharePoint server to do this.

But you need to install SharePoint PnP PowerShell

https://docs.microsoft.com/en-us/powershell/sharepoint/sharepoint-pnp/sharepoint-pnp-cmdlets?view=sharepoint-ps#installation

$encpassword = convertto-securestring -String "<<password>>" -AsPlainText -Force
 $cred = new-object -typename System.Management.Automation.PSCredential -argumentlist "<<domain\username", $encpassword
 Connect-PnPOnline <<site url>> -Credentials $cred
 Add-PnPField -List "<<list name>>" -DisplayName "<<Display name of column" -InternalName "<<internal name of column, make sure no space in name" -Type Choice -Group "<<groupname>>" -AddToDefaultView -Choices <<choice values such as - " 8"," 9"," 10">>

Reference: https://docs.microsoft.com/en-us/powershell/module/sharepoint-pnp/add-pnpfield?view=sharepoint-ps

Subscribe to my YouTube Channel https://www.youtube.com/channel/UC6vLzWN-3aFG8dgTgEOlx5g

Connect with me on Twitter or Linked In and follow YouTube Channel or my blog https://twitter.com/SinhaKislay

https://www.linkedin.com/in/kislaysinha

/https://synkventures.com

/https://www.youtube.com/channel/UC6vL…

Last week in Microsoft 365 – 29 Oct – 04 Nov 2020 – VLog 4

Subscribe to my YouTube Channel https://www.youtube.com/channel/UC6vLzWN-3aFG8dgTgEOlx5g?sub_confirmation=1

In this VLog I have covered following topics

  • Matt-Collins 366 days video streak
  • SharePoint Roadmap Pitstop Oct 2020 – Mark Kashman
  • Extend SPFx solution testability – Marcin Wojciechowski
  • GA Microsoft To Do API in Microsoft Graph – Microsoft 365 Dev team
  • What’s new in Microsoft Teams?  – Oct 2020

Hello and welcome all to series “Last week in Microsoft 365”, this is the fourth video in this series in and we have 5 topics to be highlighted this week which I liked.

1. First one is something which really inspired me when I saw this post from Matt-Collins about his 366 days video streak on YouTube and me being a new YouTuber it was great to see someone else success in this area so a big shout put to Matt-Collins of putting this through so do visit his YouTube page and check awesome videos. You can also follow him on Twitter, his videos is mostly about Dynamics 365 and Power Platform

Links: https://www.linkedin.com/posts/mattco…

https://www.youtube.com/c/MattCollins…

https://twitter.com/D365Geek

2. Second topic is SharePoint Roadmap pitstop Oct 2020 from Mark Kashman, since the last week also was month end which means we have bunch of Roadmap Pitstops. In this you also have Podcast where Mark talks to Harsh about new file sharing experience in teams channels, chats and also some other bunch of updates

Link: https://techcommunity.microsoft.com/t…

3. So the third one is which I saw on Twitter from Marcin where he has created a test sample projects for SP Developers which means how to create stubs to test out your app or web part like an example he has given to simulate Mock Order and Mock User provider, so have a look, I think this has good use case for testing.

Links: https://twitter.com/mgwojciech/status…

https://github.com/mgwojciech/unit-te…

https://mgwdevcom.wordpress.com/2020/…

4. The fourth one is General Availability of To Do API In Microsoft Graph API which is a great news as I believe lot of people might have been waiting for this, it’s a bunch of CRUD operations on Tasks list and linked resources

Links: https://developer.microsoft.com/en-us…

5. The last one today is an article “What’s new in Microsoft Teams?”, this is a collection of bunch of things announced in Microsoft Teams so let’s have a look into some of these.

Links: https://techcommunity.microsoft.com/t…

Episode 1 Link: https://www.youtube.com/watch?v=4Mteq…

Episode 2 Link: https://www.youtube.com/watch?v=811h7jrqYlg&t=127s&ab_channel=SYNKVentures-Let%27stalkMicrosoft365

Episode 3 Link: https://www.youtube.com/watch?v=SQXjobuVCqY&t

Connect with me on Twitter or Linked In and follow YouTube Channel or my blog 

https://twitter.com/SinhaKislay

https://www.linkedin.com/in/kislaysinha

/https://synkventures.com

/https://www.youtube.com/channel/UC6vL…

Last week in Microsoft 365 – 15 Oct – 21 Oct 2020 – VLog 2

In this VLog I have covered following topics

  • 1.Building a Me-experience in Microsoft Teams by Waldek
  • 2.How to use Microsoft Teams Templates as end user and Admin – Paolo Pialorsi
  • 3.General Availability of Microsoft Graph Teams Membership API – Brian T Jackett
  • 4.Improved News / Page Publishing Exprience –Marc D Anderson
  • 5.Power Automate Desktop October 2020 update

Transcript of the video:

Hello and welcome all to series “Last week in Microsoft 365”, this is the second video in this series and we have 5 topics to be highlighted this week which I liked.

1. First one is the Building a Me-Experience in Microsoft Teams which I got to know from Waldek’s blog, as it says there is no “I” but Me in Microsoft Teams. Basically it explains how you can utilize SharePoint Framework to offer a Me-Experience where users can start their day seeing their personal information. The article explains each options in very detail. So how to do it

a. Embed a modern SharePoint page: this approach is great as it does not any coding and can be done by creating modern page with different web parts and embedding it as Teams tab

b. Build a multi tab personal teams app: this requires some coding effort but not so difficult as you can steps are quite self explanatory

c. Combine multiple web parts in single tab: This is same as before but you need to use React to combine multiple React components Link: https://blog.mastykarz.nl/build-me-ex…

https://docs.microsoft.com/en-us/shar…

2. Second topic is from Paolo Pialorsi where he explains how to use recently introduced Microsoft Teams templates as an end user and Admin. He walks you through all details of the how to create a template etc from Admin portal. He also explains how you can utilize Microsoft Graph explorer Link: https://www.youtube.com/watch?v=-YQxF…

https://twitter.com/PaoloPia/status/1…

3. So the third one is General Availability of Microsoft Graph Teams Membership API which I saw from a Tweet of Brian T Jackett, basically it is an announcement made regarding Microsoft Graph Team Membership APIs that is a newly added API which adds , removes users faster. As we can see the article was originally written by Abhishek Anand. Link: https://twitter.com/BrianTJackett/sta…

https://developer.microsoft.com/en-us…

4. The fourth one is also regarding a roadmap announcement which I came to know more Marc D Andersson where we will have an improved expriences in which users needs to input mandatory fields before publishing a news or page. This is planned to be released in Oct 2020 Link: https://twitter.com/sympmarc/status/1…

https://www.microsoft.com/en-us/micro…

5. The last one today is related to Power Automate Desktop October 2020 update. Recently Microsoft has released Power Automate Desktop and lot of improvements will be released soon so here is a summary of all those. If you want to try Power Automate Desktop please refer to link pasted in description Link: https://flow.microsoft.com/en-us/blog…

https://docs.microsoft.com/en-us/powe…

Episode 1 Link: https://www.youtube.com/watch?v=4Mteq…

Connect with me on Twitter or Linked In and follow YouTube Channel or my blog https://twitter.com/SinhaKislay

https://www.linkedin.com/in/kislaysinha

/https://synkventures.com

/https://www.youtube.com/channel/UC6vL…