Friday, 20 October 2017

SharePoint Interview Questions and Answers

41.  BDC VS BCS  ?

BCS is new in SharePoint2010 and stands for Business connectivity Services. Using BCS one can read and write into the external Database. . In BDC, one can only perform the reading from external Database.

42 Business Intelligence Service in SharePoint  ?

SharePoint 2013 provides a Business Intelligence Centre site that enables your organization to centrally store and manage data connections, reports, scorecards, dashboards, Apps and Web Part pages.

43.  Services in SharePoint  ?

SharePoint 2013: Service Applications list

Access Service

Access Service 2010

App Management Service

Business Data Connectivity Service

Excel Services Application

Machine Translation Service

PerformancePoint Service

PowerPoint Automation Service

Managed Metadata Service

Search Service

Secure Store Service

State Service

User and Health Data Collection Service

User Profile Service

Visio Graphics Service

Word Automation Services

Work Management Service

Microsoft SharePoint Foundation Subscription Settings Service

44.  Upgrade and Migration in SharePoint ?

No more In-place upgrade from SharePoint 2010 to SharePoint 2013! In other words - No direct upgrade is possible from SharePoint 2010 to SharePoint 2013. You can't install SharePoint 2013 on top of SharePoint 2010 (as we can install SharePoint 2010 on top of SharePoint 2007) . So only migration is allowed in SharePoint 2013. You can't re-use your existing Hardware for SharePoint 2013 (Also you can't install both SharePoint 2010 and SharePoint 2013 on same machine).

Migration Steps Summary:

1.      Create new SharePoint 2013 Farm, Setup necessary configurations.

2.      Backup - Restore SharePoint 2010 Content Databases to SharePoint 2013's SQL Sever (or perform a detach-attach process)

3.      Verify content databases by running: Test-SPContentDatabase from SharePoint 2013 farm.

4.      Attach Content Databases to SharePoint 2013 web application by running: Mount-SPContentDatabase

5.      Upgrade Site Collections to move them into SharePoint 2013.

45.  Contents management  in SharePoint ?

Scenario 1:

SP Site has 2 document libraries

Lib1 and Lib2

In Lib1 - user can upload any kind of document .

Simply keep default

In Lib2 - Restrict user in upload only pdf's

We can create an event handler (event receiver) and triggers on item adding, that checks the file name and if it's not the correct file extension just cancel event.?

Scenario 2:

SP Site has 2 subsite for departments

S1 and S2

S1 - only HR department should see the link

S2 - only Finance department

By using following way

1.      Navigation in SharePoint using Quick Launch

2.       Navigation Bar Drag and drop feature


3.      Structural Navigation with Publishing features enabled

 

Thank you very much

          Fahadullah Karimi

         SharePoint Specialist


Previous SharePoint Interview Questions And Answers Best Practice for disposing objects in SharePoint Development

Tuesday, 17 October 2017

SharePoint Interview Questions and Answers

36.  Deployment steps in SharePoint ?


A Solution Package is a CAB file with WSP extension, which contains all the files required to implement the Features in your Visual Studio project.

Add the WSP to the SharePoint Server

The first thing you need to do is copy over the wsp deployment file. The best things to do is to create a deployment folder, where all the deployed files are kept.

Copy over the deployment files to: C\Deploy\WSP

Add the WSP to the SharePoint Farm Solution library

Open “SharePoint 2013 Management Shell “ as administrator

a. Open the Search on Server 2012

b. Search for “SharePoint 2013 Management Shell”

c. Right click “SharePoint 2013 Management Shell”

d. Select “Run as Administrator”

Run this script: 

 Add-SPSolution " C\Deploy\WSP \{file name}.wsp"  

Deploy the WSP to the SharePoint Farm Solution library

Open Central Administration

Click “System Settings”
Click “Manage farm solutions”, under “Farm Management”

Click on the {file name}.wsp package

Click “Deploy Solution”

Deployment settings

Deploy When: Now

Deploy to:  All content Web application

Click “OK”

How to activate the WSP Feature on the Site Collection

Activate the WSP Feature on the Site Collection

Open the Root Site (the Site Collection)

Click the cog, in the top right corner (Site Actions)

Select “Site Settings”

Click “Site collection features”, under “Site Collection Administrator”

Go to {file name}

Click “Activate”, to the right

37.  STSADM  VS PowerShell in SharePoint ?

Stsadm ”stands for SharePoint Team Services Administration"

It is a Command-line tool used for administration of Office SharePoint 2007 (or MOSS 2007) servers and sites and even its not Not limited to administrative needs – can be extremely helpful to developers.

 STSADM  located  under C:\Program Files\Common Files\ shared\web server extensions\12\bin.

Before SharePoint 2010, the only way to manage SharePoint at the command line was STSADM  However, in SharePoint 2010 and later, STSADM  was depreciated and replaced by PowerShell.

In SharePoint 2013 Preview, STSADM  still there and can be used, however Microsoft suggests to use PowerShell commands instead.

Therefore if you are still using STSADM  , Microsoft released a list of all the STSADM  commands and their equivalent in PowerShell to encourage you to make the switch.

STSADM  to Windows PowerShell mapping in SharePoint 2013

STSADM

 It is nothing but a Command Line tool which is more prevalent in SharePoint 2007 and slowly depreciating.

Excecuting STSADM commands always return String Values.

Looping is not Possible.

Accessing Files in the file server and registry operations are not supported.

 Powershell

Next Generation Microsoft Scripting language.

Executing Powershell Commands always returns .Net Objects. This features really improves the performance since all the SPList, SPweb objects are .Net Objects inturn.

Looping, Multiple executions are Possible being a Scripting Language.

We can easily play around with system registry as well.

38.  Difference between Event Receiver and Workflow  ?

Main Differences Between SharePoint Event Receivers and SharePoint Workflows are:

1. Event handlers Can't be manually initiated - workflows can be initiated either automatically or manually.

2. Event Handlers can be Synchronous or Asynchronous - Workflows are always async (They executes after the operation)

3. In Event Receivers we can cancel the operation (such as add/update/delete) - But in Workflows its not possible.

4. Event handlers execute from a Particular WFE, So when something goes wrong in that WFE, It may end-up. But Workflow Jobs are robust and  can resume even after Reboots.

5. Usually Event handlers runs for short period - Workflows can be longer even for years!

6. There is no User Interface/user Interaction in Event Receivers - Workflows can have user interactions such as getting user input in Initiation forms.

7. As the Name indicates, SharePoint Event receivers are triggered by events like New Item Adding-Added, Updating-Updated, Deleting-Deleted, etc. - But Workflows triggered only on Creation/Change/deletion.

8. Event Receivers are created using Visual studio - Workflows can be via SharePoint user interface, SharePoint Designer, Visio or Visual studio.

9. Workflows leaves "Workflow History" logs which we can refer for debugging - Event handler doesn't do such.

10. Event receivers are better for large volume - Workflows are better for small amount of data.

39.  Search Architecture in SharePoint 2013 ?

There are actually four types of databases for the search functionality in SharePoint 2013.

Crawl Database

Search Administration Database

Link Database

Analytics Reporting Database

Crawl Database - It stores all the crawl related information, such as the last crawl time and the last Crawl ID.

 Search Administration Database - It contains the search configuration settings, such as the search topologies, mapping between the crawled items and the metadata properties.

 Link Database - It stores information such as the search clicks along with storing information obtained from the Content Processing Components.

 Analytics Reporting Database - For generating reports on the search related information and usage analysis, this database is used.

40 User Profile Service in SharePoint  ?

The User Profile Service will allows you for configuring and managing User profile properties, Audiences, Profile synchronization settings, organization browsing and management settings, and My Site settings.

 

Thank you very much

          Fahadullah Karimi

         SharePoint Specialist


Previous SharePoint Interview Questions And AnswersNext SharePoint Interview Questions and Answers

Sunday, 15 October 2017

SharePoint Interview Questions and Answers

31.  Steps to debug  SharePoint Timer Job ?


Its pretty simple. Follow the following step to debug the Timer Job.

1. Open the Visual Studio and the Timer Job code base

2. Set the break point in the code

3. Attach the debugger to OWSTimer.exe

4. Wait for the next cycle of the timer job.

Make sure that you don’t set Timer Job interval more than 5 min for development purpose, otherwise you need to wait for longer.

You can also execute the Timer Job forcefully by writing a small console application.

or

using STSADM command line

Code:          stsadm -o execadmsvcjobs

Other Consideration:

When you change the code base for the Timer Job, deploy the new binary in GAC and RESET the OWSTimer.exe service.

Yes you are right I said OWSTimer and not IIS Reset , because timer job run inside the OWStimer process only and till you restart it, it will always run it from previously cached copy .

32.  Steps to debug SharePoint Solution ?

Debugging code is as important as writing the code. There are few differences in debugging SharePoint code as compared to traditional ASP.NET applications. In ASP.NET you can just set the breakpoint in the code. Press F5 and you can debug the code line by line. It is not as simple in SharePoint because you already have a web application up and running to which you are deploying your customization.

Following are the various techniques to debug code in SharePoint.

1.Debugging in Visual Studio

Compile your solution and deploy it (Don't press F5).

Select Tools –> Options from Visual Studio and uncheck “Enable Just My Code (Managed only)" check box.(Some server may work without doing this step so let see how it goes). Select Tools –> Attach to Process from Visual Studio and select w3wp.exe worker process you want your debugger to be attached to.

2.Disabling Custom Errors

3.Introducing Developer Dashboard

To enable the developer dashboard execute the following command through PowerShell:

stsadm -o setproperty -pn developer-dashboard -pv OnDemand

The other options for this are On and Off in place of OnDemand. After executing this command, refresh your site and you can see a new icon on the top left after the username. Click it and you can see the developer dashboard at the bottom of the same page.

33.  Best SharePoint Coding Practices ?

Some of the best coding practices that should be followed in SharePoint development

Best Coding Practice # 1

Do not instantiate SPWeb, SPSite, SPList or SPListItem objects inside event receivers

using (SPWeb web = properties.Site.OpenWeb("WebName"))

{

     SPList list = web.GetList("/Path");

     SPListItem item = list.GetItemById(theID);

}

Best Coding Practice # 2

Take advantage of ‘using’ clause, because SPWeb and SPSite objects implement the IDisposable interface, and standard .NET Framework garbage collection calls the Dispose method to free any resources associated with the object from memory.

using(SPSite oSPsite = new SPSite("http://server"))

{

  using(SPWeb oSPWeb = oSPSite.OpenWeb())

   {

       str = oSPWeb.Title;

       str = oSPWeb.Url;

   }

Best Coding Practice # 3

SPContext objects are managed by the SharePoint framework and should not be explicitly disposed in your code. This is true also for the SPSite and SPWeb objects returned by SPContext.Site, SPContext.Current.Site, SPContext.Web, and SPContext.Current.Web

using( SPWeb web = SPControl.GetContextWeb(HttpContext.Current)) { ... }

Best Coding Practice # 4

        SPWeb object from AllWebs property collection is disposed

using (SPSite siteCollection = new SPSite("http://moss"))

  {

      using (SPWeb web = siteCollection.AllWebs.Add("site-relative URL"))

      {

      } // SPWeb object web.Dispose() automatically called.

  } 

Best Coding Practice # 5

It is not advisable to call the Dispose method on the SPSite.RootWeb.

using (SPSite siteCollection = new SPSite("http://moss"))

{

    SPWeb rootWeb1 = siteCollection.RootWeb;

    // No explicit rootWeb1 dispose required.

}  // siteCollection automatically disposed by implementing using().

// rootWeb1 will be Disposed by SPSite.

 

// SPContext and SPControl

SPWeb rootWeb2 = SPContext.Current.Site.RootWeb;

// Also would apply to SPControl.GetContextSite(Context);

// No explicit rootWeb2 dispose required because it's obtained from SPContext.Current.Site.

Keeping in mind of better ways of using SharePoint objects and best coding practices as above will increase the performance of the application and also ensure the reliability.

34.  Update Vs. System Update List in SharePoint 2013 ?

      SPList lstProducts = web.Lists.TryGetList("Products"); 

       SPListItem prodItem = lstProducts.Items.Add(); 

       prodItem["ProdName"] = "PCMMigrator"; 

       prodItem["Category"] = "Sharepoint"; 

       prodItem.Update();

      //prodItem.SystemUpdate();

Update() :

In the above code the Update() method adds the data to the SharePoint Products list. When this is happening it also internally updates the built in fields the "Modified  with the timestamp of the server when it is updating" and "Modified By with the user who logged in" . And also a new version is created for the item (if versioning enabled for the list).

SystemUpdate() :

It updates the data to the SharePoint list without changing the built in Modified and Modified By fields. It will not create any new version for the item. Basically this method does all the updates to the content database directly.

 

This method also can be written with Boolean argument.

SystemUpdate(false) is equivalent to SystemUpdate()

SystemUpdate(true) is equivalent to SystemUpdate() but creates the new version for the item.

The SystemUpdate also triggers all  the list events as the update does.

In Server Object Model we can use these both Update and SystemUpdate methods. But the client object model will not allow the SystemUpdate method as it is changing data in content db directly without server knowing the changes made. If really we want to achieve this in csom, there are some alternative ways like writing a custom webservice and calling it in csom code.

35.  What is SPDataSource  and mode CrossList in SharePoint ?

SPDataSource is a web control which implements IDataSource and saves you writing code like the above. The great thing is that it is extremely flexible, and as we'll see, can be used for more than you might think. The best thing though, is that being a control it can be used declaratively, so I can bind my dropdown to the list without writing a single line of C# or VB.Net code - all I have to do is set properties correctly.

<SPWebControls:SPDataSource runat="server" ID="dsPersonTitles" DataSourceMode="List"

  SelectCommand="<Query><OrderBy><FieldRef Name='SortOrder' Ascending='true' /></OrderBy></Query>"

  <SelectParameters>

      <asp:Parameter Name="WebUrl" DefaultValue="/configuration/" />

      <asp:Parameter Name="ListName" DefaultValue="PersonTitles" />

  </SelectParameters>

</SPWebControls:SPDataSource>

<asp:DropDownList runat="server" ID="ddlPersonTitles" CssClass="title" DataSourceID="dsPersonTitles" DataTextField="Title" DataValueField="ID">

</asp:DropDownList>you are right I sai

The different 'modes' of SPDataSource

 

SPDataSource isn't just limited to fetching the items from a list (DataSourceMode = 'List'). Other possibilities are:

CrossList - similar to doing a query with SPSiteDataQuery across all lists in a site collection (for a sample of this see the SharePoint Designer Team blog post linked at the end of this article)

ListItem - show field values from a single list item

Webs - lists all webs in a site collection

ListOfLists - lists all lists in a web.

<SharePoint:SPDataSource ID="SPDataSource1" runat="server"

    DataSourceMode="CrossList"

    UseInternalName="true"

    SelectCommand="<Webs Scope='Recursive'></Webs>

                   <Lists ServerTemplate='106'></Lists>

                   <View>

                      <ViewFields>

                         <FieldRef Name='EventDate'/>

                         <FieldRef Name='Title'/>

                         <FieldRef Name='Location'/

                      </ViewFields>

                      <Query>

                         <Where>

                            <And>

                               <Eq>

                                 <FieldRef Name='Location'/>

                                 <Value Type='Text'>Your office</Value>

                               </Eq>

                               <Eq>

                                 <FieldRef Name='EventDate'/>

                                 <Value Type='DateTime'><Today/></Value>

                               </Eq>

                            </And>

                         </Where>

                      </Query>

                   </View>" >

</SharePoint:SPDataSource>

      <asp:GridView ID="GridView1" runat="server"

    DataSourceID="SPDataSource1"

    AutoGenerateColumns="false" Width="75%" HeaderStyle-HorizontalAlign="Left" >

    <Columns>

        <asp:BoundField HeaderText="Date" DataField="EventDate" />

        <asp:BoundField HeaderText="Title" DataField="Title" />

        <asp:BoundField HeaderText="Location" DataField="Location" />

    </Columns>


</asp:GridView>


 

Thank you very much

          Fahadullah Karimi

         SharePoint Specialist


Previous SharePoint Interview Questions And AnswersNext SharePoint Interview Questions and Answers