Posts

Authenticating SharePoint with Multi Factor Authentication using PnP PowerShell

Image
SharePoint PnP PowerShell is super helpful when you have a schedule jobs running. You just need to create a package and schedule it in your jobs.

But the issue comes when you have Multi-factor authentication. With Multi-factor authentication, you would need an attended access which is impossible for scheduled PowerShell execution.

We do have details in the PnP PowerShell App Permission article. But since it did not cover the complete approach, I though I would jot it down.

With that in place the solution would be to authenticate using Azure AD App authentication mechanism. We had initiate an issue in GitHub and got response from PnP Legend Erwin Van Huen that Add-In method is recommended. I had to spent some time myself for that to completed. So I thought I would jot the steps which I had followed.

Please keep in mind the pre-requisites for the below approach

PnP PowerShell in your machineSharePoint OnlineAzure AD Management PermissionSince you are going to create an Application in Az…

Deploying App in SharePoint Online - Sideloading of apps is not enabled on this site.

Its the era of Office 365 and cloud  now. On a fine day, you learned to develop app. The app is developed in Visual Studio and you are planning to deploy in your SharePoint Online site.

You created the developer's siteDeveloped the AppThen tried to deploy the App.....

Boommm!!! 
Error occurred in deployment step 'Install app for SharePoint': Sideloading of apps is not enabled on this site.
Now What??? Then comes the PowerShell scripts for your rescue.....
Thanks to Edge Pereira for the Time saver....
Execute the following PowerShell scripts. 

#CODE STARTS HERE $programFiles = [environment]::getfolderpath("programfiles") add-type -Path $programFiles'\SharePoint Online Management Shell\Microsoft.Online.SharePoint.PowerShell\Microsoft.SharePoint.Client.dll' Write-Host 'Ready to enable Sideloading' $siteurl = Read-Host 'SiteUrl' $username = Read-Host "UserName" $password = Read-Host -AsSecureString 'Password' $outfilepath = $siteurl -r…

Resource file not found for SharePoint Application

Image
Problem We had migrated one of our development application to our production environment which is on internet side. We deployed everything in the SharePoint environment and when we tried accessing the application, we were getting the strange error.
"Resource object with key Keyname not found".
We cross checked with the App_LocalResources folder in inetpub for SharePoint Application. But we could see the resource file and the needed resource key.


Solution We had given the alternate access mapping to the internet site.But the port which we had given was not 80 port it was 1489.We copied the resource file to App_LocalResource folder of the 80 folder and found that the error is gone.What we understood is that even if we give the alternate mapping in an internet facing SharePoint application, by default resource file will be looking for the resource folder of 80 Port.

Get the total hours in HH:MM from 2 different time spans.

There was a specific requirement from one of our clients. The requirement was to get the total hours worked in HH:MM from 2 different time spans. The result has to be shown in SSRS.
The expecation was like below.

Day Hours Night Hour Total Hours Worked 12:30 27:49 40:19
After detailed research and combination, we had reached the below result.

= //Converting total Minutes to Hour Format( ( //Section 1 Getting Total Minutes of Start time in HH:MM ((Mid(ReportItems!Textbox14.Value, 0 + 1, (InStr(ReportItems!Textbox14.Value, ":") ) - 1) * 60) + Mid(ReportItems!Textbox14.Value, (InStr(ReportItems!Textbox14.Value, ":") ) + 1, LEN(ReportItems!Textbox14.Value) - 1))
//Summing Total Minutes of start and end time +
//Section 2 Getting Total Minutes of End time in HH:MM
((Mid(ReportItems!Textbox18.Value, 0 + 1, (InStr(ReportItems!Textbox18.Value, ":") ) - 1) * 60) + Mid(ReportItems!Textbox18.Value, (InStr(ReportItems!Textbox18.Value, ":") ) + 1, LEN(ReportItems!Textbox18.V…