Skip to main content

Posts

Showing posts from 2019

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       client_secret: "",//Client Secret       scope: "https://graph.microsoft.com/.default"     },     s

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    $list = $lists.GetByTitle("Underwriting")  

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                    }