Hello
I am trying to register clientID to my provider hosted by running the below script, getting an error at the Register-SPAppPrincipal script. What to do?? Please help me
$appDisplayName = "SharePointApp5.App" $clientID = "f2d1bb9e-2566-426a-ab45-91735ec59357" $targetSiteUrl = "http://<server:portno>/sites/DemoSite/" $targetSite = Get-SPSite $targetSiteUrl $realm = Get-SPAuthenticationRealm -ServiceContext $targetSite $fullAppPrincipalIdentifier = $clientID + '@' + $realm Write-Host "Registering new app principal" $registeredAppPrincipal = Register-SPAppPrincipal -NameIdentifier $fullAppPrincipalIdentifier -Site $targetSite.RootWeb -DisplayName $AppDisplayName Set-SPAppPrincipalPermission -Site $targetSite.rootweb -appPrincipal $registeredAppPrincipal -Scope SiteCollection -Right FullControl Write-Host "Registration Completed"