Author Archives: deepunair

Content type view for Modern Document sets in SharePoint

We have the “Modern view” for Document Sets released !!!

Ever since the arrival of the modern pages and the modern lists/libraries in SharePoint, many of us were waiting for the modern view for Document Sets. This has finally arrived.

Here is the link to the official announcement.

Classic experience

classic

Document Set Content type view

The above view inside a Document set is the default. Most of us know that this can be converted to something like this:

classic

Notice the selection of the view as “Document View” and this view has a grouping of “Document Type” column, which gives a neat representation of the documents inside the Document Set. Cool Stuff!

To achieve this, at least some of us used the View settings >> Folders section options enabling us to have a second view, inside the Document Set content type.

Folders

This functionality of having 2 different views inside and outside the document sets in classic view even helped us work around the limitations of grouping in views (even now only 2 groupings are the maximum limit per view).

Interim Document Set experience

Until recently if you had document sets created in the modern view, you had that clunky experience of the modern library, opening document sets in a new tab as default.

But this enabled an opportunity to have different views for different content types, just like the classic experience. Kind of a mix of both worlds.

These were possible until recently because Document sets opened in a different tab by default (unlike the folder experience).

The latest roll out – Document set Modern experience = same as folder behavior

So when you get the latest release of modern experience for document sets, you lose out the “feature” of opening in a new tab; but instead, you get that nice experience of opening every set into the same tab, pretty seamlessly. This is very similar to a folder experience.

modern

Problem: No more view changes based on view settings

As you may have noticed, the experience of shifting to a different view does not happen anymore.

The settings are all the same, but somehow the View settings are not taken into account.

Solution

Reading the tech community forum discussions, I was able to understand that all the modern experience settings were controlled more or less from the “Welcome Page” of the Document Set content type found in the Document Set settings.

So, to fix the view switching issue, we just have to set the “Welcome page” view to the “Document View”

welcome

And viola!

modern-doc-view

We have Document sets opening to a different view as default 🙂

Other points to note

  • Shared metadata specified in a document set content type continues to work as it always has; values inside shared columns will be copied to items inside the document set.
  • Columns that are identified as Welcome page columns in the content type are sorted to the top of the details pane so that users can find them easily. 
  • Document set versioning functionality will appear under the context menu on document set items in the modern list view, include “Capture Version” and “Version History.”
  • However, customized document set welcome pages are not supported in modern. And therefore, this change will not affect document sets that use welcome pages that have been configured with custom HTML or web parts; those welcome pages will still be displayed in classic mode, as they are today.
Advertisements

How to find restore option for classic SharePoint libraries in Office 365

Have you heard about the new “Restore this Library” feature for modern libraries?

It’s a really cool feature for libraries and it’s pretty straightforward to get there.

To get the Restore page in a library with modern experience

If you are in the library and click on the “gear” menu, you can easily find an extra link that says “Restore this library” – support article for the feature.

Restore

To get the Restore page in a library with the classic experience

But what if you want the same for a classic library of yours. Just add “?p=18” to the end of your library hyperlink.

In short, if your library link is:

https://your-site-link/sites/site-name/library/AllItems.aspx

Add the magic query string and convert that to:

https://your-site-link/sites/site-name/library/AllItems.aspx?p=18

Pretty easy right? 🙂

Enjoy.

 

Tips for Microsoft Flow expressions

Expressions are an easy way of modifying and formulating the data that we would want to capture in Microsoft Flow.

Expressions that I used recently

Adding 90 Days as an expression –

formatDateTime(addDays(utcnow(), 90), ‘yyyy-MM-dd’)
To calculate first day of the current month –
formatDateTime(startOfMonth(utcNow()), ‘dd-MM-yyyy’)
Calculating 3 days before the first day of the current month –
formatDateTime(addDays(addToTime(startOfMonth(utcNow()), 1, ‘Month’), -3), ‘dd-MM-yyyy’)

Joining conditions like ‘And’, ‘Or’ in conditional statements –

In order to join conditions, use the “basic mode” to create all the conditions needed and copy them.
Then remove the “@” symbol from the beginning, join them with commas and add the @AND or @OR condition required.
For eg. – The below condition checks if the Title or the “Email Contact” field has the text “mailto” in it.

@OR(contains(items(‘Apply_to_each’)?[‘Title’], ‘mailto’),
contains(items(‘Apply_to_each’)?[‘Email_x0020_Contact’], ‘mailto’))

To get this first I created a condition for checking if the Title contains the “mailto” text, which gets transcribed as:
@contains(items(‘Apply_to_each’)?[‘Title’], ‘mailto’)
Similarly, for the Email Contact column, the code gets created as:
@contains(items(‘Apply_to_each’)?[‘Email_x0020_Contact’], ‘mailto’)
In order to create an OR statement between them I had to remove the “@” symbol from the beginning, join them with commas and add the @OR condition required and finally it becomes –
@OR(contains(items(‘Apply_to_each’)?[‘Title’], ‘mailto’),
contains(items(‘Apply_to_each’)?[‘Email_x0020_Contact’], ‘mailto’))

Get SharePoint list items more than the default 100 items

The Get SharePoint list items method will only retrieve the first 100 records by default.
To expand that to the desired amount of records, we will have to edit the settings of the “Get Items” property

Flow1

Flow2

 

That’s all for now 🙂

Accordion menu for SharePoint modern pages

The goal of the article is to create something like this:

Accordion

and the accordion menu expands to more text details.

Accordion1

To accomplish this, I have used the React script editor webpart that I found on GitHub combining with some good old jquery.

  • Follow the instructions to git clone and install the script editor webpart from GitHub.
  • Make sure to change the default setting to the following in the ScriptEditorWebPart.manifest.json file before deploying the app.
"requiresCustomScript": false
  • After the webpart is added to the site, add the app to the required page and insert the following text in the webpart:

<script src="Refer-Jquery-path/jquery-1.11.2.min.js"></script>
<script type="text/javascript">

$(document).ready(function(){

$(".ControlZone-control :header").css("line-height", "7%");
$(".ControlZone-control :header").css("border-top", "8px solid transparent");
$(".ControlZone-control :header").css("border-bottom", "8px solid transparent");
$(".ControlZone-control :header").css("border-left", "10px solid black");
$(".ControlZone-control :header").css("padding-left", "13px");
$(".ControlZone-control :header").css("margin-bottom", "30px");
$(".ControlZone-control :header").css("cursor", "pointer");
$(".CanvasSection-xl12 .ControlZone-control .cke_editable p").css("display", "none");
$(".CanvasSection-xl12 .ControlZone-control .cke_editable p").css("margin-bottom", "30px");

$(".ControlZone-control :header").click(function(){
$(this).nextUntil(".ControlZone-control :header").toggle();
});
});

</script>

You can also customize it further to have images or videos in each menu item.

However, you will have to add them as separate image webpart below the text webpart and tweak the jquery to combine the accordion effect on both the text and image webparts.

Convert a SharePoint designer document notification workflow to Microsoft Flow

During the migration phase of our projects from SharePoint on-premise to O365, we had to convert a couple of good old SPD workflows to Microsoft Flow.

Condition

Whenever a document in a library is due for review, i.e, 30 days before the “Next Review” date, fire a notification to the document “Owner” based on a defined template.

SPD Workflow way

When a document is created or modified, check whether the current date matches the “Next Review” date minus 30. If it doesn’t, pause the workflow until that date is reached and fire an email notification.

Microsoft Flow way

Flow

Create a Recurrence action that checks every day for each item in the library whether the condition, “Next Review” date minus 30, has reached.

It will fire emails for any document that has the condition satisfied.

The action items used here – “Recurrence” for repetition, “Get Items” for getting all items in a SharePoint library, “Apply to each” for checking the condition on each list item, “Send an email” to alert the users.

I simply love Flow, just because:

  • it’s too easy to change the email template.
  • on a flick of a button, you can switch on or off the necessary flows on a site.
  • and the best part, I can run through the executed flow on an item to item basis.

Simply easy !!!

Web Components, Angular and SPFx

An exciting announcement from the Angular team during the Angular Mix event last month has brought lot of attention around the SharePoint community.

Lets try to understand what this is all about.

What are Web Components ?

These are simple widgets that allow us to bundle markup and styles into custom HTML elements. They are not tied to any framework- purely built with HTML, CSS, and JAVASCRIPT.

To understand it easily, imagine them as web parts that we could add into any SharePoint page. These components can be plugged into any piece of existing HTML adding few lines of code.

If you are interested to know more about web components, like custom elements and Shadow DOM , this is a neat blog from css-tricks, where it is explained in detail.

BTW, most of the major browsers have pretty much good support for the web components or at least one can use webcomponents.js as polyfill.

So, in a nutshell, if you convert your widget / web part as a Web Component, then you will be able to run it pretty much everywhere, which is pretty awesome.

web_component

 

Integrating Web Components into JS Frameworks

Did you know that these web components could be integrated into the framework of your choice?

The new Angular and Vue frameworks score full points in utilizing all the web component capabilities, although React is not quite there yet.

This enables you to create your widget and utilize them in your Angular or Vue projects. This also allows you to pass attributes to your widget, have custom properties utilized and even trigger events.

web_component angular

How do you create Web Components?

To be super quick in creating Web Components, Polymer library created by Google, has done much of the heavy lifting. They have also created a bunch of  ready to use custom elements that are maintained in their Github.

You can even create Web Components using Vue.

But wait… what if you can create them using Angular too?

If you are that person who loves Angular and had problems with Angular integrating into the SPFx model, the new feature named Angular Elements that came out as part of the Angular Labs would definitely help.

This was taken a step forward when Rob Wormald from Google, during the European SharePoint Conference 2017, explained how Angular Elements could be used in a SharePoint SPFx web part.

Keep it coming…

All these announcements should help us plan better for future SharePoint developments.

I think this is the best part of SPFx, where it allows you to embrace the awesomeness that happens in the outside world.