Jean Paul's Blog

There are 2 types of People in the World, One who Likes SharePoint and..

    Advertisements
  • Microsoft MVP

  • MindCracker MVP

  • CodeProject MVP

  • eBook on SharePoint 2010

  • eBook on Design Patterns

  • eBook on Windows Azure

  • NLayers Framework @ CodePlex

  • MSDN Forums

  • .Net vs. Java

    Due to Public Demand
  • Advertisements

Archive for March, 2014

Print button on InfoPath form

Posted by Paul on March 26, 2014

In this article we can explore a real-life scenario to show a Print button on an InfoPath form in view/edit mode. You can also extend the solution to other list forms.

Why Print button needed on forms?

By default there is no print button on SharePoint forms.

clip_image002

Steps

Following are the steps needed to achieve the Print button solution. We are using HTML & JavaScript for the solution.

Step 1: Enable Modeless forms

By default the view/edit forms are opened in dialog forms. We need to change this to edit the page.

Choose List > List Settings > Advanced Settings

clip_image004

Set the last option to No.

Now you can see the View form is opened in full page mode.

clip_image006

Following is the Edit form.

clip_image008

Step 2: Edit Page

Open a list item in View Form, Choose the Site Actions > Edit Page option to bring the page to edit mode. Add a Content Editor Web part & enter the following HTML contents.

<input onclick=”window.print();” type=”button” value=”Print”/>

clip_image010

Click OK to save the changes. Choose Stop Editing from the page tab. The page will look like below.

clip_image012

We added a Print button which will invoke window.print() method on click.

Step 3: Test the page

Refresh the list & open a list item in View Page. Click on the Print button & you can see the Print Dialog appearing like below.

clip_image014

This confirms the print functionality integration. You can also repeat the same for Edit form.

Step 4: Enable back dialog

Now we need to enable back the dialog form. Go to List Settings > Advanced Settings & enable the Dialog option.

clip_image016

You can see the Print button there too.

clip_image018

The print() method prints the contents of the current window.

Custom Action

For having a custom action you can refer the solution below:

http://infopathprinter.codeplex.com/

clip_image020

References

http://www.w3schools.com/jsref/met_win_print.asp

Summary

In this article we have explored a scenario of showing Print button on InfoPath forms.

Advertisements

Posted in SharePoint, SharePoint 2010, SharePoint 2013 | Tagged: , , , | Leave a Comment »

Active Directory Sync Tool

Posted by Paul on March 23, 2014

While working with SharePoint On-Premise & Online editions, one need to perform the following:

  1. Synchronize On-Premise Active Directory Accounts to Online Active Directory
  2. Synchronize Online Active Directory Accounts to On-Premise Active Directory

In short, the requirement will be Two-way Synchronization

Active Directory Sync Tool

The Directory Directory Synchronization Tool enables us to securely synchronize selected data between an on-premise Active Directory and the Forefront Online Security.

Download

You can download the tool from following location:

image

Download Link

References

http://technet.microsoft.com/en-us/library/hh852469.aspx

Posted in SharePoint, SharePoint 2013 | Tagged: , , | Leave a Comment »

Managed Navigation

Posted by Paul on March 23, 2014

In this article we can explore the new feature in SharePoint 2013 called Managed Navigation.

What is Managed Navigation?

Managed Navigation enables to build navigation (menu bar, side bar) for a publishing site that is derived from SharePoint managed metadata taxonomy. 

Managed Navigation allows Terms to be associated with a navigation item.

What are the Advantages?

Following are the advantages of Managed Navigation:

1. Multi-Level Navigation

2. Friendly URLs

3. Centrally Managed

4. Search friendly

Multi-level Navigation helps to build sub-menus in a publishing site.

clip_image002

Friendly URLs will look like below:

clip_image004

Central Management helps us to created/update/delete navigation items in one location, without any need to duplicate the changes. All the sites & sub sites will reflect the changes immediately.

Search friendly works with the search ability & discoverability of the content which is associated with a term. Tagging a page with a term and using Search Web Part improves the search ability.

How a Managed Navigation looks like?

A page after configuration of managed navigation looks like below.

clip_image005

How to perform Managed Navigation?

Following are the steps needed to setup Managed Navigation.

Step 1: Enable Publishing Feature & Configure Managed Metadata Service

From Site Collection Features, ensure Publishing feature is enabled.

clip_image007

Configure Managed Metadata Service & Ensure the services are running correctly.

clip_image009

Step 2: Enable Managed Navigation

Open Site Settings > Managed Navigation link. Choose the Managed Navigation radio option.

clip_image011

From the third section, choose the Create Term Set option. Click OK button to continue.

After doing that you can see that the top menu bar and the side link bar got disappeared.

clip_image013

Step 3: Create Terms

Now we can create Terms to be displayed in the navigation menu & quick launch area. Open Site Settings > Term Store Management. Expand the Site Collection item and choose Create Term.

clip_image015

Create hierarchical terms like below.

clip_image017

Step 4: Test Page

Refresh the home page. You can see the Menu bar with sub-levels inside it.

clip_image019

You can click on the menu items & it will throw invalid page error, as we have not configured navigation urls. You can go back to the Term Store & Set Navigation URLs for each term.

clip_image021

clip_image023

You need to create separate pages or sites to use the URL against Navigation.

References

http://technet.microsoft.com/en-us/library/dn194311(v=office.15).aspx

Summary

In this article we have explored Managed Navigation feature of SharePoint 2013.

Posted in SharePoint, SharePoint 2013 | Tagged: , | Leave a Comment »

Copy JS files to Library using Module

Posted by Paul on March 22, 2014

Often in SharePoint Projects we need to copy our JS / CSS / IMAGE files into a SharePoint Library. We can perform the same using Visual Studio Modules and package in a WSP.

What is a Module?

Modules are containers of files. We can use Modules to deploy files through a WSP file.

Scenario

We are trying to deploy a JS file into an existing library.

Steps

Please follow the steps below to do the deployment.

Step 1: Create new project

Create a new project and name it as ModuleTest.

image

Choose the farm solution option.

image

Step 2: Add Module

Choose Solution Explorer > Add New Item > Module

image

Enter the name of the module as ModuleName for ease of understanding.

You will get the following module inside Solution Explorer.

image

Please note that there are 2 items inside a Module:

1. Elements.xml which contains information on files to be deployed

2. Sample.txt which is a dummy file to be deployed

Step 3: Add JS file

Right click on the Module & Add a new file. Name it as My.js.

image

You can also delete the sample.txt file. Now your Solution Explorer looks like below:

image

Step 4: Modify Elements.xml

We need to modify the Elements.xml now. Following is the current contents.

image

Please note that the Module contains an inner node for File. We can have multiple files deployed through this tag.

The Path of the File element shows the file path in solution. Url denotes the destination location after deployment.

In our case we need to change the destination to an existing library name. Please make the following changes.

image

We added the Url tag at the Module level to mention the library name. Specifying Type as Ghostable In Library ensures the file will be available for check in check out operations.

Step 5: Create Library

Create a library named Documents inside the SharePoint site.

image

Step 6: Deploy

Right click on the Solution Explorer and click the Deploy option.

image

Step 7: Test

Now we are ready to test the existence of file in the library. Open SharePoint & Navigate to the library.

You can see a new folder name is created.

image

Inside the folder you can find the file.

image

image

If the library name is invalid, you will get a deployment error.

How to copy to a new library?

If you wanted to copy to a new library, I would suggest add a library to the solution & ensure the library is getting deployed first. After that the module deployment should reach the correct library.

References

http://msdn.microsoft.com/en-us/library/ee231567.aspx

http://bit.ly/1f0TsWY

Summary

In this article we have explored how to deploy JS files using modules. The same knowledge can be used in deploying CSS/HTML/Image files.

Posted in SharePoint, SharePoint 2013 | Tagged: , , , | Leave a Comment »

SharePoint Anti-Virus Configuration

Posted by Paul on March 21, 2014

While working with SharePoint the Administrator may have to deal with Security Threat of virus-infected files.  The files uploaded can be infected & it can cause wide-spread across the network creating a bigger chaos of loss or productivity hours.

To tackle this problem, SharePoint provides Anti-Virus Configuration.

How to configure anti-virus?

Open Central Administration > Security tab.

You can see the Manage antivirus settings link in the appearing page.  Click on it.

image

On clicking the link, you will get the following page.

image

By default it will be unchecked.  Following are the options available:

Scan documents on upload will scan the documents on upload/save operation.

Scan documents on download will scan the documents on download operation

Allow users to download infected documents will allow users to download documents even if it is infected.  This is allowable if users have separate infrastructure to deal with infected documents.

Attempt to clean infected documents will try to clean the infected documents.

SharePoint Realtime Scan Job

Microsoft Forefront Security for SharePoint is the underlying component that performs the anti-virus functionality coupling with SharePoint.  The scanning operations will be implemented through Realtime scan jobs installed in the server.

We can configure the number of Threads  in the text box shown above.

Note

Forefront Protection is discontinued after 2015, Please find the ant-virus alternatives for SharePoint using References section.

References

http://technet.microsoft.com/en-us/library/bb795198.aspx

http://www.harbar.net/archive/2013/02/22/Antivirus-and-SharePoint-2013.aspx

Summary

In this post we have gone through an overview of Antivirus Settings in SharePoint. 

Posted in SharePoint, SharePoint 2010, SharePoint 2013 | Tagged: , | Leave a Comment »

New Developer Dashboard in SharePoint 2013

Posted by Paul on March 17, 2014

In this article we can explore the new Developer Dashboard in SharePoint 2013.

What is Developer Dashboard?

Developer Dashboard is an Instrumentation Framework. It allows us to trace request, SQL queries, and ULS logs within the browser.

The URL for accessing Developer Dashboard is:

http://server/_layouts/15/devdash.aspx

Following is the screen shot of the latest Developer Dashboard.

image

How to enable Developer Dashboard?

By default the Developer Dashboard is disabled.

We have to turn it to ON state from the current OFF state. To turn it ON, open the SharePoint Command Window (In Administrative Mode) & enter the following PowerShell command.

if ((Get-PSSnapin “Microsoft.SharePoint.PowerShell” -ErrorAction SilentlyContinue) -eq $null)
{
    Add-PSSnapin “Microsoft.SharePoint.PowerShell”
}

$content = ([Microsoft.SharePoint.Administration.SPWebService]::ContentService)

$dashboardSettings =$content.DeveloperDashboardSettings

$dashboardSettings.DisplayLevel = [Microsoft.SharePoint.Administration.SPDeveloperDashboardLevel]::On

$dashboardSettings.Update()

On enabling it, we can see the Dashboard icon in default master page.

image

Please note that you can get the PowerShell Snapin Script from here:

http://www.sharepointcto.com/PowerShell/PowerShell.aspx

Instrumentation

We can click on each Request URL to view the associated Instrumentation data:

1. Server Info

2. Scopes

3. SQL

4. SPRequests

5. Asserts

6. Service Calls

7. ULS

8. Cache Calls

SQL

Using the SQL tab, we can extract the SQL associated with a request.

image

You can click on the SELECT link to see the query associated.

image

ULS

Using the ULS tab, we can extract the Unified Logging Service outputs associated with a request.

image

image

Please note in SharePoint 2010 we had the ULS integrated with the page which lead to page loading performance issues.

References

http://msdn.microsoft.com/en-us/library/office/ff512745(v=office.14).aspx

Summary

In this article we have explored New Developer Dashboard & How to enable it.

Posted in SharePoint, SharePoint 2013 | Tagged: , , | Leave a Comment »

SPCOP – Another Need Tool

Posted by Paul on March 17, 2014

SPCOP CE is a Visual Studio extension to analyze SharePoint code.

SharePoint Code Check Community Edition

image

We can analyze different SharePoint versions using it:

  1. MOSS 2007
  2. SharePoint 2010
  3. SharePoint 2013

It analyzes the following:

  1. Memory Dispose Check
  2. Features, Content Types, List Templates
  3. XML files
  4. ASPX, ASCX files

It also provides continuous integration facilities.

Download

You can download the tool from:

http://visualstudiogallery.msdn.microsoft.com/c991a9ed-7a7b-465f-9be3-923443fd6e7b

image

Installation

Download & Install the tool. 

image

I am using Visual Studio 2012.  After installations restart Visual Studio.

We can do a simple testing to ensure it is working.

Testing

Create a new console SharePoint project & add a web part into it.

Inside the web part, please add the following code.

(Please note that we are not disposing the explicitly created SharePoint object)

image

Build the project & run SharePoint Code Check from the Solution Menu.

image

If successfully installed, you can see the Dispose error being caught.

image

This confirms you have SPCOP CE successfully installed.

References

http://blogs.msdn.com/b/torstenmandelkow/archive/2013/04/15/sharepoint-code-analysis-framework-beta-released.aspx

Summary

In this post we have explored another need tool for SharePoint application development.  For advanced needs like verifying WSPs, there is a client tool available with higher editions.

Posted in SharePoint, SharePoint 2010, SharePoint 2013 | Tagged: , , , | Leave a Comment »

Activate Solution is Disabled (greyed out)

Posted by Paul on March 17, 2014

image

Solutions

Following are the solutions that we can try one-by-one:

  1. Restart Internet Explorer in Administrator Mode
  2. Ensure SharePoint User Code Host is running in Windows Services
  3. Ensure Microsoft SharePoint Foundation Sandboxed Code Service is started in Central Administration > Manage Services

Once applying the solution(s) the Activate button turned to be Enabled now. Great!!

image

Posted in SharePoint, SharePoint 2010 | Tagged: , , , , , , | 2 Comments »

Migration Template

Posted by Paul on March 11, 2014

In the world of SharePoint, occasionally we need to work with other worlds too.

For example: Migration is such an area of work.

image

What is Migration?

Migration is the process of moving from one computing system to another.

For example Migration can be:

1. SharePoint older-version to SharePoint newer-version

2. Another CMS to SharePoint

3. SharePoint to Another CMS

4. SharePoint On Premise to SharePoint Online

What will be the Migration Steps?

Migration requires the following aspects:

1. Analyzing existing environment

2. Capturing migration elements

3. Creating a migration plan

4. Creating a target staging environment

5. Performing migration against staging environment

6. Analyze the readings

7. Optimize strategies

8. Declare migration dates to stake holders

9. Take production to offline

10. Perform final migration

11. Validate migration

12. Take production to online

image

Migration Template

Following are the screen shots of a Migration Template to capture information about source system. You are free to download it.

image

Screen shots from the template.

image

image

image

image

Please note that in a typical scenario, automated/manual migration happen from source to staging & then automated migration to production.

A good automation tool I can recommend is Sharegate. Spending for automation tool is worth if the no-tool cost is higher than tool-cost.

References

http://en.share-gate.com/

Summary

In this article we have explored migration overview and a shareable template.

Posted in SharePoint, SharePoint 2010 | Tagged: , , , | Leave a Comment »