Thursday, 30 July 2020

How to add, edit and Remove Footer links in Modern communication site

In previous blogs we learn how can we enable footer and set logo and footer text on SharePoint Online Modern Communication site. If you have not gone through that you can use below link to check that post.


In this blog, we are going to see what are the options to add links. So let's get started.

Once you enable footer, you can see footer in the bottom of the footer.

Add Footer Links:
To add footer links, follow below steps:
  • Scroll to the bottom of the page.
  • Click on Edit.
    Note – If you do not see this, then you do not have enough permission.
  • It will open new panel in the left side of the screen.

  • If you want to display links to specific group, enable Site navigation audience targeting. We will discuss about this in detail in next blog

  • Click on “+” icon to add new link.
  • When you click “+” icon, it will open dialog besides it. You need to fill below values:
    • Choose whether you want to add link or label
      • If you select link, you can provide “Address”. In this you can specify URL where user will be redirect on click.

      • If you select label, address field is disabled.

    • Provide Display Name. 
    • Click OK.
  • Repeat above steps to add more links/ label. You can total 8 links. After 8 links add button will be disabled.

  • Click “Save” once all changes are done.
  • Refresh page to see result if you don't see changes after save click.

Edit Footer Links:
    To edit footer text, follow below steps:
    • Scroll to the bottom of the page. 
    • Click on Edit.
      Note – If you do not see this, then you do not have enough permission.

    • It will open new panel in the left side of the screen.
    • Click on “…” beside link / label. 
    • It provides multiple options like
      • Edit - It will provide option to edit
      • Move Up - It will move current link to one step up.
      • Move Down - It will move current link to one step down. 
      • Remove - It will remove the link

    • Click on Edit.
    • It will open edit link dialog. This will be same as we explain in add link.
    • Make changes and click OK.
    • Click Save.
    • Refresh page to see result if you don't see changes after save click

    Remove Footer Links:
    To remove footer text, follow below steps:
    • Scroll to the bottom of the page. 
    • Click on Edit.
      Note – If you do not see this, then you do not have enough permission.

    • It will open new panel in the left side of the screen.
    • Click on “…” beside link / label. It will provide multiple option. 
    • Click on remove.

    • Click Save.
    • Refresh page to see result if you don't see changes after save click.


    In next blog we will check out the audience targeting settings for the Footer links. 

    Monday, 27 July 2020

    How to set footer logo and footer text in Modern communication site

    In last blog we learn how can we enable footer on SharePoint Online Modern Communication site. If you have not gone through that you can use below link to check that post.

    In this blog, we are going to see what are the options to set logo and text. So let's get started.

    Follow below steps to set footer logo:

    • Go to Setting -> Change the look -> Footer.
      (you can find steps in detail in first blog)
    • There you can see upload logo option. Click upload. Select the file from your local system. 

    • Click save

    • It will be displayed to footer.

    To add footer text, follow below steps:
    • Go to Settings -> Change the look -> Footer
    • Add text in display name.

    • Click Save.
    • It will show in the left bottom corner.

    In next blog we will see how we can set footer links. What are layout option to show the links and what are the limitation of the Modern footer.

    Saturday, 25 July 2020

    How to enable Footer in a SharePoint Modern Communication Site

    SharePoint Online introduce Modern Sites and with it introduce OOTB Footer. Generally we are not used to it but one of our customer wanted to learn more about it and asked us to prepare document on it.

    We thought as it has been some time, we will get detailed blog on it easily. But it seems it is been described only in Microsoft Document. And I have put reference of it in the end of this post. It is good but it seems very less described and not updated with new updates. So I am trying to explain it in as detail as I can in this footer series. So lets get started.

    First of all we need to make sure the Footer is enabled in the Modern Communication SharePoint site.

    Notes -
    • Footer is not available in Modern Team site as of now.  
    • Footer will be enabled by default for all new communication sites after the feature is rolled out. If you can see the footer on your modern communication site, skip this steps
    Follow below steps to enable the Footer:
    • Click on “Settings”.
    • Click on “Change the look” option.
      Note – If you are not seeing this option then you do not have enough permission on this site.



    • Click on Footer

    • Make sure footer is enabled. If not enable it.

    • Once you enable, it will show different option. We will look in to them in next post. Click Save.

    • Once your enable it , it will display in the bottom of the page.


    You can enable this using PowerShell as well. For this you will need PNP Powershell installed in your system. In case you don't have PNP PowerShell Set up, check this blog.

    Below is PNP PowerShell command to enable footer:

    Connect-PnPOnline -Url "<SiteURL>" –Credentials (Get-Credential) 
    Set-PnPFooter -Enabled:$false

    Lets configure the footer in the next blog.

    Reference:
    https://docs.microsoft.com/en-us/sharepoint/dev/features/site-footer

    Wednesday, 1 April 2020

    Office 365/SharePoint Online - PowerShell Script to get Unique Visitors & Total Views count for Site Page

    Problem Statement -

    We have a client with a large SharePoint Tenant, want to know the Total Views count along with Unique Visitors count for each Post/Page, they are adding every day for their employees.

    Analysis -

    Currently, Microsoft is working on Analytics API that is supposed to give you the details regarding total view count and unique view count for specific item. Even though it is released but not working for a single item.

    The alternative way is to use the SharePoint Search API. This will use Microsoft Classic Search results and provide you count based on that.

    Resolution -

    We have decided to go with the SharePoint Search API approach. We have found an article with the same idea. The only concern was, using Search API directly can return max 500 rows as a result at a time. So, we need to generalize that script in such a way that it can be executed for all items in the list/library.

    So, here is generalized the Power-Shell script:

    Step 1 - Load required dependencies/assemblies:
    # Paths to SDK. Please verify location on your computer.  
     #Add-PSSnapin Microsoft.SharePoint.PowerShell  
     [System.Reflection.Assembly]::LoadFrom("C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.dll")  
     [System.Reflection.Assembly]::LoadFrom("C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.Runtime.dll")  
     [System.Reflection.Assembly]::LoadFrom("C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.Search.dll") 

    Step 2 - Create a Function - to get all list items and using search query to retrieve ViewsLifeTime & ViewsLifeTimeUniqueUsers for each item:
    function Get-SPOListView  
     {  
       param(  
       [Parameter(Mandatory=$true,Position=1)]  
       [string]$Username,  
       [Parameter(Mandatory=$true,Position=2)]  
       $AdminPassword,  
       [Parameter(Mandatory=$true,Position=3)]  
       [string]$Url,  
       [Parameter(Mandatory=$true,Position=4)]  
       [string]$ListTitle  
       [Parameter(Mandatory=$true,Position=5)]  
       [string]$TenantUrl  
       )  
      #Get the SharePoint List/Library.
       $ctx=New-Object Microsoft.SharePoint.Client.ClientContext($Url)  
       $ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($Username, $AdminPassword)  
       $ll=$ctx.Web.Lists.GetByTitle($ListTitle)  
       $ctx.load($ll)  
       $ctx.ExecuteQuery()  
      #Get all items from the List/Library.
       $qry = [Microsoft.SharePoint.Client.CamlQuery]::CreateAllItemsQuery()  
       $items = $ll.GetItems($qry)   
       $ctx.Load($items)  
       $ctx.ExecuteQuery()  
       foreach($listItem in $items)  
       {  
         Write-Host "ID - " $listItem["ID"] "Title - " $listItem["Title"] "EncodedAbsUrl - " $listItem["FileRef"]     
         $fileurl = $TenantUrl+ $listItem["FileRef"]  
         #Using Search API - Create the instance of KeywordQuery and set the properties.
         $keywordQuery = New-Object Microsoft.SharePoint.Client.Search.Query.KeywordQuery($ctx)   
         #Sample Query - To get the result of last year.
         $queryText="Path:" + $fileurl  
         $keywordQuery.QueryText = $queryText  
         $keywordQuery.TrimDuplicates=$false  
         $keywordQuery.SelectProperties.Add("ViewsLifeTime")  
         $keywordQuery.SelectProperties.Add("ViewsLifeTimeUniqueUsers")  
         $keywordQuery.SortList.Add("ViewsLifeTime","Asc")   
         #Search API - Create the instance of SearchExecutor and get the result.
         $searchExecutor = New-Object Microsoft.SharePoint.Client.Search.Query.SearchExecutor($ctx)  
         $results = $searchExecutor.ExecuteQuery($keywordQuery)  
         $ctx.ExecuteQuery()  
         #Result Count  
         Write-Host $results.Value[0].ResultRows.Count  
         #CSV file location, to store the result  
         $exportlocation = "C:\Pages_ViewsCount - Copy.csv"  
         foreach($result in $results.Value[0].ResultRows)  
         {  
           $outputline='"'+$result["Title"]+'"'+","+'"'+$result["Path"]+'"'+","+$result["ViewsLifeTime"]+","+$result["ViewsLifeTimeUniqueUsers"]   
           Add-Content $exportlocation $outputline   
         }   
         #}  
       }  
     }

    Step 3 - Call the above function:
    # Insert the credentials along with Admin & Tenant URLs and Call above Function.  
     #Enter Username here  
     $Username="username@sharepoint.com"  
     #Enter Password Here  
     $Password=Read-Host -Prompt "Password" -AsSecureString  
     #URL of the site collection  
     $rootUrl= "Root Site collection URL"  
     $ListTitle= "Site Pages"  
     $TenantUrl= "Your tenant URL E.g. https://YourCompany.sharepoint.com"  
     Get-SPOListView -Username $Username -AdminPassword $Password -Url $rootUrl -ListTitle $ListTitle -TenantUrl $TenantUrl 

    It will export all items of the list with Total views count - ViewsLifeTime & Unique views count - ViewsLifeTimeUniqueUsers in excel sheet as shown in below image:


    In case you need the dll files, you can download from below link
    https://drive.google.com/file/d/1P9YzJUvCeAfnZ8xIr-7SKCN2fisbRP6a/view?usp=sharing

    References