Showing posts with label Powershell. Show all posts
Showing posts with label Powershell. Show all posts

Thursday, December 2, 2021

SharePoint Online: Temporary fix for error The user or administrator has not consented to use the application with ID named 'PnP Management Shell'

 Hello All,


You will be shocked to see the error The user or administrator has not consented to use the application with ID named 'PnP Management Shell'  after using Connect-PnPOnline cmdlet for SharePoint Online.

There is a temporary solution. 

Solution: Downgrade your PnP module to version 3.20.2004.0

Here's what happened to me.

I got new laptop and setting up my Dev environment. 

- Installed PnP module (latest version)

- Tried connecting SharePoint Online using Connect-PnPOnline

- Got the error The user or administrator has not consented to use the application with ID named 'PnP Management Shell'

- Official solution is to ask admin to approve "PnP Management Shell" app

Seriously !!! Come on. 

As a SharePoint developer, I dont want to request Admins for these things.

PnP was very powerful tool for developers but now ?

Few experts were providing the solution to use Connect-PnPOnline -Url <siteurl> -Interactive . It didn't help.

On the PnP github, someone said that he downgraded the PnP version. 

I tried and it worked. 

Temporary solution

UnInstall-Module -Name "PnP.PowerShell"

Install-Module -Name SharePointPnPPowerShellOnline -RequiredVersion 3.20.2004.0

Sharing is caring. 


Wednesday, July 20, 2016

SharePoint Online MobileExcelWebAccess Feature - Unable to create site using custom template

I am sure you would have got this error suddenly while creating sites using custom template in SharePoint Online.
Error: MobileExcelWebAccess Feature e995e28b-9ba8-4668-9933-cf5c146d7a9f Not activated



Microsoft is unsure about the issue but there is a fix. 

Prerequisites:
- You should be an Administrator 
- Windows PowerShell
- SharePoint Online Management Shell
- SharePoint Online Client Components SDK (Download: http://www.microsoft.com/en-us/download/details.aspx?id=42038)

Steps: 
1. Open Windows PowerShell in Administrator mode and execute the script
         Set-ExecutionPolicy -ExecutionPolicy Unrestricted

2. Open SharePoint Online Management Shell in Administrator mode and execute the script

$clientDll = [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client")
$runtimeDll = [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client.Runtime")


$url = "https://<your site collection url>"


$cred = get-credential

$clientContext = New-Object Microsoft.SharePoint.Client.ClientContext($url) 
$credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($cred.username, $cred.password) 
$clientContext.Credentials = $credentials 

if (!$clientContext.ServerObjectIsNull.Value) 
{ 
    Write-Host "Connected to SharePoint site: '$Url'" -ForegroundColor Green 
}

$clientContext.Site.Features.Add('e995e28b-9ba8-4668-9933-cf5c146d7a9f',$true,[Microsoft.SharePoint.Client.FeatureDefinitionScope]::None)

$clientContext.ExecuteQuery()

Note: Do not forget to replace the $url with your site collection url

Alternatively, you shall save the above #2 script in .ps1 file and execute it.
To execute the .ps1 in SharePoint Online Management shell;
- Open SharePoint Online Management Shell in Administrator mode
- Go to the directory where you have .ps1 file
- Type .\<file name>
- A prompt will be displayed that asks your credential (Administrator)

That's it !!!!!

Wednesday, March 28, 2012

Anonymous access to SharePoint 2010 list forms

You could have faced a strange issue when accessing SharePoint 2010 list forms on anonymous access. I have a Publishing Site with FBA authentication. I was using calendar control with overlays to display the events to all users. calendar control uses "DispForm.aspx" to display the event details to the user. But when anonymous users click on the Title, the page redirects to the Login form.

Its the problem with ViewFormPagesLockdown.

To overcome this problem, I executed the below code in PowerShell;

To determine if a site has ViewFormPagesLockdown enabled run the following:

get-spfeature -site http://sitecollectionURL

If ViewFormPagesLockDown is listed, it's enabled.


$lockdown = get-spfeature viewformpageslockdown

disable-spfeature $lockdown -url http://sitecollectionURL


If anonymous is already setup, you may need to disable\re-enable anonymous on the site.


Happy Coding :)