Friday, January 16, 2015

Infosys SharePoint Interview Questions

Here are few SharePoint interview questions asked in a technical interview in Infosys.

1- Tell something about yourself specially the projects you have done in SharePoint

2- What are the difference between SharePoint 2013 and 2010

3- What are App models and what is the difference between sharepoint hosted app and provider

hosted app?

4- What is difference between site collections and sites? When to choose site collection over sites?

5- What is a visual web part? And where you have used visual web part is your project?

6- What is feature? How you can deploy your feature?

7- Have you created any master page in SharePoint 2013?

8- What is difference between Site definition and site template?

9- What is difference between SPSite and SPWeb?

10- Can you write some server object model code to insert an item to a sharepoitn list.

11- Have you worked in infopath in sharepoint 2013? Next version of infopath will not come, then

why you still working on that?

12- Have you written any CAML query? Can you write a sample query?

13- Have you ever work on Search?

14- How crawling works in SharePoint 2010?

15- How search will work if you try to retrieve items from a very large list (more than 1 lakhs

records are there)?

16- My SharePoint site's performace is not good, what are things you will check?


Monday, January 12, 2015

Cancel not completed workflows using PowerShell in SharePoint 2013

We can cancel all workflows having status not equal to "Completed". Suppose you have a list which contains more than 1000 items and you realize the workflow which is attached to the list going to Suspended state or in progress state. Here if you want to cancel the workflows which are not completed, then it can not be a manual task when your list is larger. If you have 10/20 items then you can do manually, but in other case manual process is not a good option.

Also check out: Find larger files inside web application in SharePoint using PowerShell

I got a very good PowerShell approach from Raymun Macaalay's Dev Blog to cancel workflows. Thanks to the author for sharing this.

Below is the PowerShell script:
#Your Shaeproint Site URL
$web = Get-SPWeb "http://yoursharepointserver.com/yoursubsite";
$web.AllowUnsafeUpdates = $true;  
#Your List Name
$list = $web.Lists["YourListName"];
$count = 0
#Loop through all Items in List then loop through all Workflows on each List Items.        
foreach ($listItem in $list.Items)
{
 foreach ($workflow in $listItem.Workflows)
 {
  #Disregard Completed Workflows
  if(($listItem.Workflows | where {$_.InternalState -ne "Completed"}) -ne $null)
  {
   #Cancel Workflows      
   [Microsoft.SharePoint.Workflow.SPWorkflowManager]::CancelWorkflow($workflow);    
   write-output "Workflow cancelled for : " $listItem.Title;
  }
 }
}
$web.Dispose();


Remove Sharepoint 2013 Quick Launch bar

We can hide quick launch bar in SharePoint 2013 by using css property.

We can remove that by using css and also we can remove that by modifying the master page. If you will modify through css code, then this is going to be page specific, mean which page you want to hide, you need to write the css code in that page.

You can also see: Different ways to add video into blog post in SharePoint 2013

1st Approach:
Put the below css code in the page using a script editor web part to hide the quick launch bar. Edit the page and then add a web part and then selece script editor web part from the web part gallery.

<style>
#sideNavBox { display: none }
</style>

Here sideNavBox is the <div> id of the Qucik launch bar.

Once you put the above code, it will hide the bar. But the content will be in the same place. If you want to move the content box a bit left then you can give some margin-left to the content box like below:
<style>
#sideNavBox { display: none }
#contentBox { margin-left: 25px }
</style>

Here contentBox is the <div> id of the Content box.

In which page you want, you can put the above code in Script editor web part.

2nd Approach:
Rather than putting the code in every page, you can put the code in the master page itself. If you put in the master page, then whatever page inherit the master page, will reflect those changes. By default Team site uses seattle.master page. Ok here one point, before doing any changes to the master page, please take a backup of the page and then modify on the page.

You can edit the master page using Sharepoint 2013 designer and then put the below code inside the <body> tag.

<style>
#sideNavBox { display: none }
#contentBox { margin-left: 25px }
</style> 


Twitter Delicious Facebook Digg Favorites More