Approaches For Showing The Tasks Assigned To The Logged In User From The Current Site Collection Using Office 365 And SharePoint Online

Background

In our SharePoint online portal, we have “MyTasks” Web part, which shows the tasks, assigned to the current user, across the site collection. We have implemented this requirement, using SandBox solution. Thus, from SandBox solution, with the help of Server Side Object model, we were querying to Site Collection, based on the list type “Task”.

Suddenly news appears, where Microsoft has depreciated the SandBox solution and custom SandBox solution will work only for a  few days (30 days they were saying). Thus, we must need to change the implementation of our SandBox solutions.

Thus, we are trying to find the right approach to implement this requirement and we found few of those, which I will discuss in this article with pros and cons of respective approaches.

Approaches

  • OOB Search (Content By Search web part)

    This is the first default option, which came to mind. Here, the only issue is time is required to update the search index. Minimum crawling time is 15 minute and it's not confirmed. Crawling may take more time than 15 minutes. Our customer does not want that time too. If the crawling duration is of no issue to customers, I feel this is the best possible solution to implement.

    Pros

    1. OOB approach available.
    2. Very easy to configure.
    3. No throttling issue.
    4. Formatting result is easy through Display Templates.

    Cons - Crawling duration.

  • OOB Content Query webpart (CQWP)

    This is also one of the finest options. Unfortunately, CQWP didn't worked for us. We have multiple task lists in Site Collection and have large numbers of items, available in the task lists. CQWP throws throttling exceptions, as shown in Figure 1, given below. Thus, this option also didn't worked for us. If search is not working and if there are not many items in Tasks List or only a few tasks lists, this OOB solution is preferred.

    throttling exception - CQWP
    Figure 1 : Throttling exception - CQWP

    Pros - OOB approach is available. No customization.

    Cons

    1. Throwing throttling exception.
    2. Formatting is not easy. Must require knowledge of XSLT.

  • Using JSOM (Java Script Object Model)

    This is a customized option available. Unfortunately, there is no option to query Site Collection, using JSOM. There is no API available to query Site Collection. We can only query to a list at a time. Thus, in this case, we need to travel through whole Site Collection and and query to each Task list and aggregate the result.

    Pros - We can achieve the result.

    Cons - I am sure, this Web part will be very slow. Traveling through whole Site Collection and then query each Task list. Render the result on the page and it will be very slow.

  • Provider Hosted App

    We can implement the Provider hosted app (ASP.NET/ MVC) and host on the remote Server. Provider hosted app will communicate with Office 365, using Client Side Object Model (CSOM) and show the result.

    Pros

    1. Code will be not be executed on our Office 365 environment and it will be executed on the remote Server.
    2. Implementation will be easy.
    3. Result formatting will be easy.

    Cons

    1. We will need remote Server to host the Provider Hosted App.
    2. We need to apply our custom master page for same look and feel.
    3. User will be redirected out of Office 365 site.

Up Next
    Ebook Download
    View all
    Learn
    View all