Forum Discussion
prashantguptag
Aug 16, 2018Brass Contributor
MS Graph API to access SPO with Powershell
Hi, I want to automate one task in Office 365 by using powershell and for this I registered an app in AAD (V2 endpoint https://apps.dev.microsoft.com) and given access to MS Graph API with permissio...
Deleted
Aug 17, 2018to get the clientcontext you would do something like this:
$clientContext = New-Object Microsoft.SharePoint.Client.ClientContext($siteUrl)
$clientContext.Credentials = $credentials
if (!$clientContext.ServerObjectIsNull.Value)
{
Write-Host "Connected to SharePoint Online site: '$siteUrl'" -ForegroundColor Green
}
- prashantguptagAug 19, 2018Brass Contributor
Thanks but I am expecting to authenticate to SPO with the same App principal. In your example I have to pass the credentials which will not work in my case because I want to use the app id and secret.