Skip to main content

Posts

SPFx File Upload using Pnp

Today I came across a requirement to upload file to SharePoint Document library. This task was to be done using SPFx. Pnp helped me with this. Here is the code i used. Below is the code for uploading file and meta data. private   UploadFile ():  void  {          let   input  = < HTMLInputElement >  document . getElementById ( "fileUpload" );          let   files  =  input . files ;          for  ( let   index  =  0 ;  index  <  files . length ;  index ++) {              const   file  =  files [ index ];              if  ( file . size <=  10485760 )    {      //upload...

MS Flow Check if List Item has Attachment

Today I was working with an MS Flow, Flow was responsible to trigger email when List Item was added and then delete it. While working on this, I faced issues with checking if List Item has Attachments. Flow has an inbuilt option to check "Has Attachment" column value. I don't know why but somehow it didn't work for me. So, as an workaround. I used "Get Attachments" action. Later, In next step we will be checking if "Get Attachment" returns something in body. So, If "Get Attachments" body has length of 0 or more. Based on this we can take further actions. Thanks, Keyur

Fetch outlook Calendar Events in SharePoint Webpart

Today I came across a requirement to get outlook events to SharePoint custom webpart. Thanks to Graph API to ease the work. Here are the steps that we need to follow in order to get events. 1. Register a new app in Azure Active Directory . Here is the blog that i referred. 2. Now its time to get access token using generated client id and secret in previous step. Execute below code to get access token. $.ajax({     type: "POST",     crossDomain: true,     url:       "https://cors-anywhere.herokuapp.com/https://login.microsoftonline.com/<Tenant ID>/oauth2/v2.0/token",     headers: {       "content-type": "application/x-www-form-urlencoded"     },     data: {       grant_type: "client_credentials",       client_id: "", //ClientId@TenantId ...

Enable Folder Creation option in all SharePoint Online Sites using PowerShell

Below is the Powershell script to Enable Folder creation option on Document Library. [System.Reflection.Assembly]::LoadFile("C:\Program Files\Common Files\microsoft shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.dll")| Out-Null [System.Reflection.Assembly]::LoadFile("C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\16\ISAPI\Microsoft.SharePoint.Client.Runtime.dll")| Out-Null function Get-SPOAllWeb {    param (    [Parameter(Mandatory=$true,Position=1)] [string]$Username, [Parameter(Mandatory=$true,Position=2)] $AdminPassword,         [Parameter(Mandatory=$true,Position=3)] [string]$Url )   $ctx=New-Object Microsoft.SharePoint.Client.ClientContext($Url)   $ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Username, $AdminPassword)   $ctx.Load($ctx.Web.Webs)   $ctx.Load($ctx.Web)    $lists = $ctx.web.Lists   ...

Get list of External users from all Site Collections in Office365

Below is the powershell script to iterate through all Site Collections and get list if External users per site collection. $Sites = Get-SPOSite | select * foreach($Site in $Sites)         {                    Write-Host "Getting External Users from " $Site.Url            Get-SPOUser -Site $Site.Url |  Where-Object { $_.LoginName -like "*EXT*"} |ft -AutoSize                    } 

How to make SharePoint Site/Master page Responsive

Lets try to make a SharePoint site responsive. Making a SharePoint site responsive is a two way process. Making Master page Responsive. Making SharePoint page layouts responsive. Making contents that is gonna load on the page responsive. Note : I would recommend to use Bootstrap in order to make site responsive. Lets now start with making a responsive master page. First of all you need to have a responsive HTML site. Take the portion that you want to add into master page and uploaded the derived portion with all necessary reference files into SharePoint master page gallery. Now  publish the master page and click on the gear icon on top right corner > Click on design manager > Under D esigner Manager click on Edit Master Pages option and then click on  Convert an HTML file to a SharePoint master page option Select your html file. You will now be redirected to Preview page. You can have a look at the page and resolve issues if you find any.  ...