Tuesday 20 October 2015

SSRS Integration with SP2013

Introduction

SSRS (SQL Server Reporting Services) is a tool that help us to create, deploy and manage reports. It supports variety of data sources. SSRS can be installed in two modes viz. Native mode & Integrated mode and can be used in either of two modes. In this articles, I will walk you through SSRS installation in integrated mode and its integration with SharePoint 2013.

Software Requirements

    ·         SQL Server 2012 R2/2014 Enterprise Edition
    ·         SharePoint 2013
    ·         MS SQL Server 2012/2014 Add-in for SharePoint 2013

It will be a standalone server architecture, where all required softwares will be installed on single server. However we can extend it to multiple server. Just to keep the things easy, I will explain the Single Server Architecture.

Implementation Steps
Step 1: Install SQL Server Reporting Services and SQL Server Database Engine:
Run the SQL Server Installation Wizard to install SQL server.  While doing the installation, it will ask for feature selection where you can specify the features which are required to be installed.
In share features select Reporting Services – SharePoint and Reporting Services add-in for SharePoint as shown below:
On the Reporting Services Configuration page you should see the Install only option is selected. This option installs the report server files, and does not configure the SharePoint environment for Reporting Services.

Step 2: Install MS SQL 2014 Reporting Services Add in for SharePoint 2013
If the MS SQL 2014 Reporting Services Add in for SharePoint 2013 is not installed during SQL Server 2014 installation, please download and install it from this link.
The SQL Server 2014 Reporting Services Add-in for Microsoft SharePoint technologies allows you to integrate Reporting Services features with the collaborative SharePoint experience.
Step 3: Install and Configure SharePoint 2013
Run the setup of SharePoint to start installation. While configuring a SharePoint farm, specify the System Account (domain account) as a farm admin. Configure the SharePoint server to use above installed instance of SQL server 2014.

Step 4: Activate Reporting Services feature
       a.  Open Central Administration.
       b. Go to Site Settings
       c. Under Site Collection administrator, click Site collection Features
       d. Activate Report Server Central Administration feature
       e. Activate Report Server Integration feature.
Step 5: Register and Start Reporting Services SharePoint Service
The following are the common reasons why you need to manually register the Reporting Services service.
You installed Reporting Services SharePoint mode before SharePoint was installed. The account used to install Reporting Services SharePoint mode, was not a member of the SharePoint farm administrators group.  The necessary files were installed as part of the SQL Server installation wizard, but the services need to be registered into the SharePoint farm. The SQL Server 2014 release introduces PowerShell support for Reporting Services in SharePoint mode.
Open the SharePoint PowerShell and run following commands:

Install-SPRSService
Install-SPRSServiceProxy
Step 6: Create SSRS Service Application
Below are the steps to create a service application and a description of the properties:
1.       In SharePoint Central Administration, in the Application Management group, click Manage Service Applications.
2.       In the SharePoint ribbon, click the new button.
3.       In the New menu, click SQL Server Reporting Services Service Application.

Fill in the necessary details and the Service Application is ready to be used.
Step 7: Create BI site and Configure Document library for Reports
Create a new BI site from Central Admin by selecting Business Intelligence template in Enterprise section. Create a document library and add below three content types:
      ·         Report Builder
      ·         Report Model
      ·         Report Data Source
Step 8: Upload Reports and attach Data Source
You can create SSRS reports using SSDT or Visual Studio or SSRS Report Builder tool. Upload the .rdl (Report Definition Language) files and .rsds(Report Server data Source) files in document library. Attach the .rsds file to .rdl file by selecting manage data source.
That’s it guy’s, we have successfully integrated SSRS with SharePoint 2013. Click on any rdl file, it will redirect you to a report UI.

Summary
I walked you through the integration of SSRS with SharePoint 2013. I faced some issues while doing it but by following these steps you will not get any issues. If you face any problem while doing, you can contact me J
Happy reading. Have a great day ahead
You can write your feedback in comments below that will help me in improving myself. Thanks! Cheers J


Saturday 10 October 2015

Custom Workflow Activity

Create Custom Workflow Activity in SharePoint 2010

This blog demonstrates how to build the custom workflow activity in Visual Studio 2010 and use this workflow activity in SharePoint Designer 2010 as a custom action.
First you need to create the “Empty SharePoint Project” in Visual Studio 2010.


Please provide the URL of the SharePoint Site where you want to deploy the workflow. Also 
make sure that you select the “Deploy Solution as a farm solution”. Click next after that.


Before you begin you need to add the following reference to your project.
§  Microsoft.SharePoint.dll
§  Microsoft.Office.Workflow.Actions.dll
§  System.Workflow.ComponentModel.dll
There are two major steps to create a Custom action:
1.    Add a .class File
2.    Add WSS.actions file

Add a .class file
Add the new class to the solution and make sure that class is public otherwise you will get the “protection level error”. Inherit the class from Activity class. You must include using System.Workflow.ComponentModel to resolve the “Activity”.
Now you need to create the dependency properties to access the input given to the activity or to use the current library id and current item.
Definition: Dependency properties provide a centralized repository of a workflow’s state.Dependency Property provide a mechanism that allows SharePoint Designer to provide values for your custom action before you add your custom functionality.
To allow SharePoint Designer to pass values to your custom action when the workflow runs, you must create public properties inside your custom action.
The dependency properties can be created as:

/// <summary>
/// The dependency property for List ID.
/// </summary>
public static DependencyProperty __ListIdProperty = DependencyProperty.Register(“__ListId”, typeof (string), typeof(CustomWFAction));

Here CustomWFAction is a class name that we have created.

/// <summary>
/// Gets or sets the list or library ID.
/// </summary>
public string __ListId
{
get {
return ((string)this.GetValue(CustomWFAction.__ListIdProperty));
}
set {this.SetValue(CustomWFAction.__ListIdProperty, value); }
}

This property will provide you the current list or library id as a Guid on which workflow is running on. In the similar you can create required dependency properties and get/set their values. You can create a dependency property for Workflow Context, List litem id or any specific input that will be given to the workflow activity.
Now we are ready with the inputs to access the list or library with the current item ID on which workflow is running and the current context of the workflow (Create the dependency property for workflow context). We need to override the “Execute” method to execute the code.
The code for Execute () goes here.

/// <summary>
/// Write the actual code to be executed here.
/// </summary>
Protected override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext)
{

    //Write the code here that is to be executed by activity.
    //Ex: Update the item title

 SPWeb web=__Context.Web;
 string listID= __ListId;
 int itemID = __ListItem;
 SPList lstDemo = web.Lists[new Guid(listID)];
 SPListItem lstItemDemo = lstDemo.GetItemById(itemID);
 if (lstDemo.Fields.ContainsField(“Title”))
{
  lstItemDemo[“Title”] = “Demo Activity executed”;
}
 lstItemDemo.Update();
 return base.Execute(executionContext);
}

Add WSS.actions file
Now we need to create the action file for the activity. Right click on the project and click on the add button and then select the “SharePoint Mapped Folder” which maps to workflow folder as shown below:


Now right click on the workflow folder and then add the new text file. Rename the text file with .actions extension.
Add the following code in the file and save it.

<? xml version=”1.0″ encoding=”utf-8″?>
<WorkflowInfo Language=”en-us”>
<Actions Sequential=”then” Parallel=”and”>
<Default>
<RuleDesigner Sentence=”Run action %1″>
<FieldBind Id=”1″ Function=”true”/>
</RuleDesigner>
</Default>
<Action Name=”UpdateItem” ClassName= ” My_CustomActivity.CustomWFAction”
Assembly=” IBSP_CustomActivity, Version=1.0.0.0, Culture=neutral, publicKeyToken = 87cb7fe4b26ece9b” Category=”SharePoint 2010 Actions” AppliesTo=”all” UsesCurrentItem=”true”>
<RuleDesigner Sentence=”Perform demo action”>
</RuleDesigner>
<Parameters>
<Parameter Name=”__Context” Type=”Microsoft.SharePoint.WorkflowActions.WorkflowContext, Microsoft.SharePoint.WorkflowActions” Direction=”In”/>
<Parameter Name=”__ListId” Type=”System.String, mscorlib” Direction=”In” />
<Parameter Name=”__ListItem” Type=”System.Int32, mscorlib” Direction=”In” />
</Parameters>
</Action>
</Actions>
</WorkflowInfo>

Deploy Custom Workflow Action
Now we have workflow activity ready with us. We now need to deploy this activity and use this activity using SharePoint Designer. Update the web.config file on the Site virtual directory folder where we need to create the workflow. Go to the “C:\inetpub\wwwroot\wss\VirtualDirectories\80” location and open the web.config file. Made the following entry to under the “<authorizedRuleTypes>” section.

<authorizedType Assembly=”System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089″ Namespace=”System.Runtime.CompilerServices” TypeName=”ExtensionAttribute” Authorized=”True” />

If you do not register it in web.config file, the action will be visible in workflow actions menu of SharePoint designer but will not get inserted into actual workflow. Restart the IIS after this step. Now Open the SharePoint designer 2010 and open the site where you want to create the workflow. Click on the “Workflows” from the left navigation bar and create the list workflow. Provide the Name and Description of the workflow. Then click on the action menu and now you will see the custom action under the “SharePoint 2010” group that we have created. Select the action and then publish the workflow.

Happy learning. J Have a great day.

Tuesday 6 October 2015

Tiles WebPart SP2013

Introduction
SP2013 has lot of new features. Tiles web part is one of them. It has a nice look and feel which attracts users. There can be such a scenarios where we need to provide a quick links section, the Tiles web parts is the perfect match for such requirements. This article will walk you through how we can implement tiles web parts and use of JQuery to meet our specific requirements.
Scenario
In a SharePoint site, a quick links section has links to important pages, sub sites, externals links, and important documents of our site. The links will have their names and URL associated with it. These links should open in a new tab, new window, same page, in a pop up as per the requirements. Each links should have nice look and feel with background image.
This is how the Tile web part will look like:

























Implementation Steps
I will not talk much about it. J Let’s start with the implementation now.

STEP 1: Select add an app form Site settings.



























STEP 2: Select promoted links.


























STEP 3: Give a proper name. I have given a name “Quick Links”.



























STEP 4: Select Quick links app it will redirect you to Tiles.aspx page. To add items (links) to the list, click on All Promoted links.



























STEP 5: Click on new item to add an item to the list.




























STEP 6: Fill below details.

6.1 Title
6.2 Background image location: Image URL to be displayed
6.3 Description: will be shown as a short description on mouse hover event of a tile.
6.4 Link location: target URL for click event
6.5 Launch Behavior: In page Navigation or Dialog or New tab
6.6 Order: Sequential position
























Similarly add other items to the list.

STEP 7: Edit a page where you want to add the Tiles web part and click on add web part. Select the Quick Launch.
That’s it guys, it will show you the Quick Launch Tiles web part like this:























Summary
This is how we can implement Tiles web part in SP2013. It has another name as Promoted Links. In the next blog I will show you, how we can implement a role based menu to show the specific tiles to specific users depending upon users permissions. Happy reading. Have a great day ahead.
You can write your feedback in comments below that will help me in improving myself. Thanks! Cheers  :)

5 Steps to achieve Lazy Loading in SharePoint

Hello SharePointers!   Through this blog, I will walk you through a JS library implemented by me which helps us to load SharePoint list it...