Certificate based authentication for Security and Compliance Center PowerShell

If you are currently using Basic Authentication for application access, then you are required to migrate to Certificate based authentication prior to mid February.

Microsoft is rolling out this change and it should be completed by early March. With this update, Security and Compliance PowerShell will enable configuration of certificate based authentication to allow unattended app-only access.

To migrate to certificate based authentication follow the steps below:

Learn more:

Renaming folder using REST API and Nintex workflow – SharePoint 2013

When working with Nintex workflow Item Update activity you would realize that it has different properties for document library and lists. For example if you are updating an item in document library it will allow you to update both Name and Title vs in Custom list it will only give you title.

This works perfectly fine until someone decided to use the folders in custom list and then have a business process to rename the workflow. Then Item update activity would not work in this case. Since to rename workflow you would need to set the Name property and not the title property but since it’s a custom list Workflow only property that is available to you is Title.

Workflow would run just fine and update the title but when you click on the folder it will display the folder Name and not the title.

With this business problem I have decided to use the REST API to update the folder Name. I am not going to talk too much about how to use the REST API with Nintex workflow since there is a good article on that. You can read about it at the following URL.

https://community.nintex.com/community/build-your-own/blog/2015/04/24/how-to-execute-a-rest-api-request-with-nintex-workflow

 

Only change you would need to do to change the folder Name is in the last step. In the last step you would need to change the property that you would like to update. So in our case it will become,

{

     '__metadata' : { 'type' : '{WorkflowVariable:listItemEntityType}'},

     'Title' : 'Folder Title',

     'FileLeafRef' : 'Folder Name'

}

And that is all you would need to do to rename a folder. Knew it would be simple but since I had to plug that REST API using the Nintex workflow there is some plumbing that you would need to do. 🙂

SharePoint Online – Picture Column and Column Formatting

I had earlier blogged about Microsoft Rolling out column formatting to the first release tenants and how it could be useful in many scenarios.

For anyone who wants to get started with column formatting following article is by far the best technical documentation.

https://docs.microsoft.com/en-us/sharepoint/dev/declarative-customization/column-formatting

Today I am going to talk about one specific scenario where you could use column formatting.

Let’s assume that you want to create a picture column in SharePoint to show some sort of status progress. I know we can achieve this in many ways but just for the sake of this blog post we are going to assume that you have a column in your list/library of type Picture.

Now in SharePoint Online when you have a picture column and you insert the URL of the image in that column it displays the image. This image is clickable and when you click on that image it opens the new tab with the image displayed.

This behavior may work in some scenarios but in our case since we want to use this picture column just to show the status progress we do not want that image to be clickable.

We can use column formatting for this. Follow the steps below to make that image not clickable.

  • Open context menu on your image column and select à Column Settings à Format this column.
  • This should open JSON editor on right hand side.
  • Paste the following code in the editor and click Save.
{
    "elmType": "div",
    "children": [
        {
            "elmType": "img",
            "txtContent": "",
            "style":{
                "min-height": "initial",
                "margin-top": "0px"
                                },
            "attributes": {
                "src": "@currentField",
                "width": "100%"
            }
        }
    ]
}

As you can see I am not doing anything extra ordinary. I am simply displaying the same image without anchor link. If you follow the article that I have linked above you would be able to figure out it’s straight forward.

One thing that I needed to do on top of that is to add couple of styles. Since when you use column formatting it uses its default class and that makes your image smaller and aligns it to the top.

I have set min-height and margin-top attributes to align images properly with the list item as well set the width to 100% so it does not shrink the image.

I hope this helps to get started with the column formatting.

In the next column formatting article I will cover how to make image clickable using the URL from the different column.

OneDrive for Business – Getting access of user’s OneDrive

If you have been using OneDrive for business then you should know that OneDrive behind the scene is SharePoint site collection which only users have access. For example I will be the Site Collection Admin on my OneDrive and no one can access my OneDrive unless I decide to share document or folder sitting in my OneDrive. This is perfectly fine as long as user is active.

What if user left the organization and you would want to get access. Once the user leaves the organization OneDrive is smart enough to give access of that OneDrive to user’s manager and gives them about two weeks to take any backup etc.

In other scenarios where user is active but running into some issues like lost files etc.

In both of the above cases you have another option to get user’s OneDrive as long as you are SharePoint Administrator on your tenant.

  1. Visit the SharePoint admin center using the URL https://tenant-admin.sharepoint.com/ (Replace tenant with your tenant name).
  2. Click on User Profiles and then click Manage User Profiles.
  3. Find the user and click “Manage Site Collection Owners” for that user using the dropdown menu.
  4. This would open the popup dialog where you would user is set as Primary Site Collection Owner as well as Site Collection Owner.
  5. You can simply add the backup person’s name under Site Collection Owner and click OK.

Now I have validated the above steps works just fine as long as user is active but in some cases when user is disabled the above steps does not work. It will let you add the Site Collection Owner but that change will not take place.

In that case you can user the following PowerShell to work around this issue.

$creds = Get-Credential

Connect-SPOService -Url "https://tenant-admin.sharepoint.com" -credential $creds

Set-SPOUser -Site "https://tenant-my.sharepoint.com/personal/USER/" -LoginName "[email protected]" -IsSiteCollectionAdmin $true

I hope this helps.

SharePoint Online – Column Formatting – Using different columns

I had earlier blogged about Microsoft Rolling out column formatting to the first release tenants and how it could be useful in many scenarios.

For anyone who wants to get started with column formatting following article is by far the best technical documentation.

https://docs.microsoft.com/en-us/sharepoint/dev/declarative-customization/column-formatting

Today I am going to talk about one specific scenario where you would want to use other fields data on the current item.

Most column formatting examples you would see are based on the current column where you could refer the column using @currentField. In some scenarios you would want to leverage other field values in the same item. e.g. If column X value is Y then change the background color of my current column.

So for this example I am going to have two columns i.e. Picture Column and HyperLink column.

What I want to do is when my items are displayed picture is clickable and it opens a URL in your HyperLink column and opens in a new tab.

Here is code.

{
 "elmType": "a",
 "attributes": {
 "href": "[$HYPERLINK_FIELD_NAME]",
 "target": "_blank"
 },

"children": [ 
 {
 "elmType": "img",
 "txtContent": "",
 "style":{
 "min-height": "initial",
 "margin-top": "0px"
 },
 "attributes": {
 "src": "@currentField", 
 "width": "100%"
 }
 }
 ]
}

Here I have element type <a> and then I am using element type <img> as the children. Most of the image element stuff you see around style is just to align it properly.

The key thing is element type <a> where I am setting href to other HYPERLINK column value and I reference that column by using the [$FieldName]. The column is formatted within the context of the entire row. You can use this context to reference the values of other fields within the same row.

I hope this helps.

SharePoint Hub Sites – New way to organize your intranet

During Ignite 2017 Microsoft announced Hub Sites. Just to recap Hub sites provides following capabilities.

Cross-site navigation
Content rollup
Consistent look-and-feel
Scoped search

Today Microsoft announced that they are starting to roll-out the hub sites. Here is the screen shot from Microsoft Official blog post about this event.

https://techcommunity.microsoft.com/t5/SharePoint-Blog/Organize-your-intranet-with-SharePoint-hub-sites/ba-p/174081

First question that comes to mind is how do I use Hub sites with my existing SharePoint sites.

Currently you can convert existing communication site or modern team time into a hub site. Microsoft’s recommendation is to select (either existing or new) communication site as the hub site. Once a hub site is created, approved site owners can associate existing team sites and communication sites with the hub site.

You will need to use Register-SPOHubSite PowerShell CMDLETS to enable the Hub Site. You must be a SharePoint administrator or above in Office 365 to create SharePoint hub sites. Site owners can associate a SharePoint site with a hub site that already exists.

There is Ask Me Anything Hub Sites happening and I encourage everyone to join and ask any questions that you may have.

https://techcommunity.microsoft.com/t5/SharePoint-AMA/bd-p/SharePointAMA

This is pretty exciting announcement as first release tenants will have Hub Sites available in next month or so.