Add Modern SharePoint Site Page in Microsoft Teams

Microsoft Teams is a chat-based workspace that brings together people, conversations, content, and tools for easier collaboration. SharePoint sites include the modern page feature, which allow you to engage the team members with important or interesting stories. Here I am going to show you how to display a SharePoint modern page with in teams as a tab.

I have created a SharePoint modern page as show below:


Set up SharePoint Modern Page in Teams

  • In Teams, navigate to the team where you want your SharePoint page to appear.


  • Click the plus sign to add a new tab.


  • Click on Website


  • Provide a Tab name and SharePoint Modern page url and click Save. Optionally we can select Post to the channel about this tab check box to communicate this change with the users.


  • That’s it! Now, every time you visit your team, the newly added tab will appear as part of the teams as shown below


  • You can use the expand / collapse button to view the content the way you like


Notes :

  • I don’t know if you noticed, but the out of the box sharepoint controls such as Suite Bar, Left Navigation, Search Box, Page Title Area and Command Bar are gone within teams.
  • If you have custom webparts within the page, you can not edit properties of those within teams.
  • You can not change the web part arrangement sequence within teams.
  • You can not display classic page.

Azure Traffic Manager for Provider Hosted Apps – Global Load Balancing

Microsoft Azure Traffic Manager allows us to control the distribution of user traffic to the specified endpoints (Zone Specific Azure Sites).

Azure Traffic Manager gives us three traffic routing methods to choose from:

  • Failover
  • Performance
  • Round robin.

We can choose the one that is right for our application or scenario.


  • Traffic Manager can improve the availability of important applications by monitoring our Azure sites and automatically directing users to a new location anytime there is a failure.
  • Traffic Manager makes applications more responsive and improves content delivery times by directing users to an Azure or external location with the lowest network latency.
  • Traffic Manager can direct user traffic to distribute it across multiple locations

Steps to load balance provider hosted apps

  • Create Azure websites in different zones
  • Create a Traffic Manager profile
  • Configure End Points (Zone Specific Azure Sites)
  • Point the company Internet domain( to a Azure Traffic Manager domain(
  • Publish the web deploy packages separately in each azure website. We need to do this two times, one for each azure website data center location.
  • The azure website virtual directory is accessible using the TM URL ). So while registering the app we must give the TM URL for the following parameters
    • App Domain:
    • Redirect URI:



SharePoint Online – Install / Upgrade App from App Catalog Out Of The Box


I want a custom app to be installed by default whenever a site is created with a specific site collection/managed path/template and users from that site should not remove that app from that site. The best way to implement this is to create a feature stabling with custom site definition. Unfortunately, SharePoint Online does not support feature stabling or site definition.


As a SharePoint or global admin in Office 365, you can create an App Catalog site to make internally developed custom apps available for users to install when they browse apps under the From Your Organization filter on the Site Contents page. Site owners can then add these apps.

  • The first step is to create the App Catalog site collection if it hasn’t already been created.
  • Once the App Catalog has been provisioned, upload the first version(my first version: of your app in the app catalog site.
  • Install the first version of your app in the app catalog site.
  • Select the ellipses ( …) next to the app, select the ellipses ( …) again in the callout to view the menu, and then select Deployment.


  • Now you will be redirected to the “Manage App Deployments” page where in you can configure where you wish to install the app. App can be installed with Site Collections, Managed Paths and Site Templatesbased scopes.



  • Configure the setting as per your requirement and click Ok  (if required trust the app)
  • In this example, I wanted to install my app in site collection under sites managed path with Developer Site templates only.
  • Now the app should be installed in the above said sites

Note: If you notice, the app information callout’s footer section is rendered only with an About callout action and user can not remove the app from the site.


  • Now upload the next version( of your app in the app catalog site
  • Upgrade the app in the app catalog site


  • Now your app should get upgraded automatically in the sites you configured in step # 4.


This approach provides the flexibility and governance for SharePoint add-in deployments.

Download SharePoint Online Files using MAC CURL Command

Problem Statement
MAC SharePoint users were downloading the files from SharePoint 2007 Document Libraries using the CURL command but the same is not working after migrating the SharePoint 2007 sites to SharePoint Online(SPOL).


Screen Shot 2018-09-13 at 10.58.26 AM.png

SharePoint Online uses claims based authentication and direct NTLM based curl commands are not allowed.

SPOL allows remote applications to call the REST API with user impersonation. This article demonstrates how to access SPOL REST API and download the files from a tenant using Apple Bash Script and Curl commands. However, outside of .NET the authentication piece is not so straightforward. App authentication solves this issue for registered apps but in this document you will see how remote user authentication can be achieved, regardless of platform.

The below diagram illustrates the HTTP requests which need to be made in order to authenticate SharePoint Online.


Applies To
Office 365 Tenant connected with Active Directory Federated Service(ADFS) and MAC OS

Execution Steps

  • Download the file from here
  • Open file in a text editor(TextWrangler/TextMate) and update the UserName (Line #4) and Password (Line #5).


Note: The UserName & Password provided should have access to download the file from SharePoint Online.

  • To download the file from a different SharePoint Online site/library/folder/file where the account has access, change the values of EndPoint(Line #6) and FileServerRelativeUrl(Line #7) values.
  • Save the file
  • Open Terminal (command line tool) and go to the path where file is saved
  • Execute the following command to convert the file executable chmod 700
  • Run the script using just the name of the script(Example : ./
  • If all goes well, you should be able to see the downloaded file in the output path given in OutputFilePath(Line #9).

Failure Chances

  • UserName and Password provided might be wrong
  • Access denied from SharePoint Online for the UserName and Password provided
  • Provided Site/Document Library/Folder/File is not available in SharePoint Online or wrong
  • Text Editor might have changed or corrupted the file while saving

O365 / SharePoint Online – Load And Install App using CSOM & PowerShell


Write-Host “Load XML config file” -foregroundcolor black -backgroundcolor yellow

$xdoc = [xml] (get-content “C:\config.xml”)

$url = $
$username = $xdoc.Tenant.Admin.username
$password = $xdoc.Tenant.Admin.password
$appfilepath = $xdoc.Tenant.appfilepath
$Password = $password |ConvertTo-SecureString -AsPlainText -force

Write-Host “Global variables loaded succeefully” -foregroundcolor black -backgroundcolor Green
Write-Host “Problem in loading the XML or parsing the variables : $_.Exception.Message” -foregroundcolor black -backgroundcolor Red

Write-Host “Load CSOM DLLs” -foregroundcolor black -backgroundcolor yellow Set-Location

$loadInfo1 = [System.Reflection.Assembly]::LoadWithPartialName(“Microsoft.SharePoint.Client”)
$loadInfo2 = [System.Reflection.Assembly]::LoadWithPartialName(“Microsoft.SharePoint.Client.Runtime”)

Write-Host “CSOM DLLs loaded succeefully” -foregroundcolor black -backgroundcolor Green

Write-Host “Problem in loading CSOM DLLs : $_.Exception.Message” -foregroundcolor black -backgroundcolor Red

Write-Host “Authenticate tenant site $url and get ClientContext object” -foregroundcolor black -backgroundcolor yellow

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

$web = $context.Web
$site = $context.Site

Write-Host “Authentication to online site $url and get ClientContext DLLS succeeful” -foregroundcolor black -backgroundcolor Green

Write-Host “Unable to authenticate to online site. Error : $_.Exception.Message” -foregroundcolor black -backgroundcolor Red

$appIoStream = New-Object IO.FileStream(“C:\” ,[System.IO.FileMode]::Open)
$appInstance = $web.LoadAndInstallApp($appIoStream) | Out-Null
Write-Host $appInstance.Id

Write-Host “Unable to Install App Error : $_.Exception.Message” -foregroundcolor black -backgroundcolor Red

O365 Custom JavaScript Injection using PowerShell

Custom action fetches an external script and includes it in the page. So at run time the script will self execute as an anonymous function.

Following are few scenarios you may need this functionality in your SharePoint Projects:

1) Override the new sub site link ( under Site Contents  with your site provisioning app URL

2) Redirect the user to specific page

3) Inject third-party JavaScript libraries such as Jquery, Knockout, AngularJs, etc.,

4) Add dynamic html (global navigation / company copy rights information on the bottom of your page) content on your sharepoint page at run time without even modifying the actual master page.

In the below example, I have explained how to inject Jquery file to one of my web. The source files can be placed in CDN / File Share / Common Location such as App Catalog.

Please feel free to change the logic as per your requirement.

Note: The logic remains same for JSOM code also.