Friday, April 26, 2013

SharePoint Interview Questions Part3

When do you use SPSiteDataQuery?
You can use SPSiteDataQuery when you need to extract data from more than one list\library in your site colletcion. The data is extracted on the basis of the query you write and is returened as a Datatable. You can also specify the GUID for the lists\libraries you want to query against.

How do you create a Custom action for an item in a list?
This can be done by adding a new feature into SharePoint. You would need to use customaction tag in your elements.xml file and will have to set various properties like imageurl or UrlAction for your customaction. You can later add this feature into sharepoint using stsadm install feature command.

How would you bind this CustomAction to a specific list?
To do this you can either create a new list type(again a feature) and use the listtype number for the new list in your RegistrationType property of the Customaction. The CustomAction will then show up only for the items of this list type. or You can create a new content type and then use that content type's id in your cutsomaction to bind the custom action to items of just that content type. Add the new content type to the list where you need this customaction.

How will you deploy an existing asp.net webapplication or website in SharePoint?
You would need to wrap the web application in a solution package in order to deploy it in 12 hive or say ShraePoint. It is recommended to create a feature first, and then wrap everything in a Solution package. See example Depoly a Custom aspx Page in SharePoint

How will you cancel a deployment from central admin -> solution managment, if its stuck at “deploying” or “Error”?
You can either try to force execute timer jobs using execadmsvcjobs command or can cancel the dpeloyment using stsadm command stsadm –o cancaldeployment –id {GUID} command. The Id here would be GUID of the timer or deployment job. You can get the Id from stsadm enumdeployment command. This will display all the deployments which are process or are stuck with Error.

How do make an existing non-publishing site Publishing?
You can simply activate the SharePoint Publishing Feature for the Site, you want to make publishing.

Can you name some of the tools used for SharePoint Administration?
Tools Used for SharePoint Administration

What are Application Pages in SharePoint?
Unlike site pages (for example, default.aspx), a custom application page is deployed once per Web server and cannot be customized on a site-by-site basis. Application pages are based in the virtual _layouts directory. In addition, they are compiled into a single assembly DLL.
A good example of an Application Page is the default Site Settings page: every site has one, and it's not customizable on a per site basis (although the contents can be different for sites).
With application pages, you can also add inline code. With site pages, you cannot add inline code.

What is Authentication and Authorization?
An authentication system is how you identify yourself to the computer. The goal behind an authentication system is to verify that the user is actually who they say they are.
Once the system knows who the user is through authentication, authorization is how the system decides what the user can do.

How do you deploy a User Control in SharePoint?
You deploy your User Control either by a Custom webpart, which will simply load the control on the page or can use tools like SmartPart, which is again a webpart to load user control on the page. User Control can be deployed using a custom solution package for the webapplication or you can also the control in the webpart solution package so that it gets deployed in _controlstemplate folder.

Which is faster a WebPart or a User Control?
A WebPart renders faster than a User Control. A User Control in SharePoint is usually loaded by a webpart which adds an overhead. User Controls however, gives you an Interface to add controls and styles.

What SharePoint Databases are Created during the standard Install?
During standard install, the following databases are created:
  • SharePoint_AdminContent
  • SharePoint_Config
  • WWS_Search_SERVERNAME%_%GUID_3%
  • SharedServicesContent_%GUID_4%
  • SharedServices1_DB_%GUID_5%
  • SharedServices1_Search_DB_%
  • GUID_6%WSS_Content_%GUID_7%

What are content types?
A content type is a flexible and reusable WSS type definition (or we can a template) that defines the columns and behavior for an item in a list or a document in a document library. For example, you can create a content type for a leave approval document with a unique set of columns, an event handler, and its own document template and attach it with a document library/libraries.

Can a content type have receivers associated with it?
Yes, a content type can have an event receiver associated with it, either inheriting from the SPListEventReciever base class for list level events, or inheriting from the SPItemEventReciever base class. Whenever the content type is instantiated, it will be subject to the event receivers that are associated with it.

Can you add a Cutsom Http Handler in SharePoint?
Yes, a Custom httphandler can be deployed in _layouts folder in SharePoint. Also, we need to be register the handler in the webapp's webconfig file.

While creating a Web part, which is the ideal location to Initialize my new controls?
Override the CreateChildControls method to include your new controls. You can control the exact rendering of your controls by calling the .Render method in the web parts Render method.

How do you return SharePoint List items using SharePoint web services?
In order to retrieve list items from a SharePoint list through Web Services, you should use the lists.asmx web service by establishing a web reference in Visual Studio. The lists.asmx exposes the GetListItems method, which will allow the return of the full content of the list in an XML node. It will take parameters like the GUID of the name of the list you are querying against, the GUID of the view you are going to query, etc.

How Do you deploy Files in 12 hive when using wspbuilder or vsewss?
Typically, you can add these files in the 12 hive folder structure in your project. In Vsewss however, you will have to create this structure manually.

What files gets created on a file system, when a Site collection is created?
Windows SharePoint Services does not create any files or folders on the file system when the site collection or sites are created; everything is created in the content database. The Pages for the site collection are created as instances in the content database. These instances refer to the actual file on the file system.

What are Customized and Uncustomized Files in SharePoint?
There are two types of Pages in SharePoint; site pages (also known as content pages) and application pages.
Uncustomized:
When you create a new SharePoint site in a site collection, Windows SharePoint Services provisions instances of files into the content database that resides on the file system. That means if you create a new Site "xyz" of type Team Site(or Team sIte Definition), an instance of the Team Site Definition( Which resides on the File System), i.e. "xyz" gets created in the Content database. So, When ASP.NET receives a request for the file, it first finds the file in the content database. This entry in the content database tells ASP.NET that the file is actually based on a file on the file system and therefore, ASP.NET retrieves the source of the file on the file system when it constructs the page.
Customized:
A customized file is one in which the source of the file lives exclusively in the site collection's content database. This happens When you modify the file in any way through the SharePoint API, or by SharePoint Designer 2007,which uses the SharePoint API via RPC and Web service calls to change files in sites. So, When the file is requested, ASP.NET first finds the file in the content database. The entry in the database tells ASP.NET whether the file is customized or uncustomized. If it is customized, it contains the source of the file, which is used by ASP.NET in the page contraction phase.

What are event receivers?
Event receivers are classes that inherit from the SpItemEventReciever or SPListEventReciever base class (both of which derive out of the abstract base class SPEventRecieverBase), and provide the option of responding to events as they occur within SharePoint, such as adding an item or deleting an item.

When would you use an event receiver?
Since event receivers respond to events, you could use a receiver for something as simple as canceling an action, such as deleting a document library by using the Cancel property. This would essentially prevent users from deleting any documents if you wanted to maintain retention of stored data.

If I wanted to restrict the deletion of the documents from a document library, how would I go about it?
You would create a event receiver for that list/library and implement the ItemDeleting method. Simply, set: properties.Cancel= true and display a friendly message using Properties.Message("How can u delete this... Its not your stuff!");

What is the difference between an asynchronous and synchronous event receivers?
An asynchronous event occurs after an action has taken place, and a synchronous event occurs before an action has take place. For example, an asynchronous event is ItemAdded, and its sister synchronous event is ItemAdding

How do you Increase trust level for a single WebPart in the WebConfig file?
To list a Web Part with Full Permissions within your Web Application while still retaining a WSS_Minimal permission set for all other Web Parts, You need to create a Custom policy file. This file will be then referenced in SharePoint Web.config file and will allow your specific webpart to be of Full trust.
Steps:
  1. Make a copy of the WSS_Minimal.Config file from the 12\Config folder and paste it into the same folder renaming it to Custom_WSS_Minimal.Config.
  2. Now, edit the Custom_WSS_Minimal.Config file using NotePad. Obtain the Public Key Token for the Web Part assembly that you want to deploy, using the following command: sn –Tp filename.dll.
  3. Create a new entry in your Custom_WSS_Minimal.Config file for your WebPart.
  4. Save the File.
  5. Finally, Create a new TrustLevel element for your config file in the Web.Config called Custom_WSS_Minimal that points to your custom file in the 12\config folder.
  6. Recycle the Application Pool and You’re Done.

How does Windows SharePoint Services help render the Webapplictaion in ShrePoint?
When a new web applictaion is created via Central Admin, Windows SharePoint Services creates a new Web application in IIS. Then the WSS, loads the custom HTTP application and replaces all installed HTTP handlers and modules with Windows SharePoint Services–specific ones. These handlers and modules essentially tell IIS to route all file requests through the ASP.NET 2.0 pipeline. This is because most files in a SharePoint site are stored in a Microsoft SQL Server database.

How would you pass user credentials while using SharePoint WebService from your Web Part or application?
The web service needs credentials to be set before making calls.
Examples:
    listService.UseDefaultCredentials = true; 
    // use currently logged on user
    listService.Credentials = new System.Net.NetworkCredential(
    "user", "pass", "domain");
    // use specified user

How would you remove a webapart from the WebPart gallery? Does it get removed with Webpart retraction?
No, Webpart does not get removed from the WebPart gallery on retraction. You can write a feature receiver on Featuredeactivating method to remove the empty webpart from the gallery.

What is a SharePoint Feature? Features are installed at what scope?
A SharePoint Feature is a functional component that can be activated and deactivate at various scopes throughout a SharePoint instances, scope of which are defined as:
  1.  Farm level
  2. Web Application level
  3. Site level
  4. Web level
Features have their own receiver architecture, which allow you to trap events such as when a feature is Installing, Uninstalling, Activated, or Deactivated.

What type of components can be created or deployed as a feature?
We can create menu commands, Custom Actions,page templates, page instances, list definitions, list instances,event handlers,webparts and workflows as feature.

How Do you bind a Drop-Down Listbox with a Column in SharePoint List?
Method 1 : You can get a datatable for all items in the list and add that table to a data set. Finally, specify the dataset table as datasource for dropdown listbox.
Method 2 : You can also use SPDatasource in your aspx or design page.

How Does SharePoint work?
The browser sends a DAV packet to IIS asking to perform a document check in. PKMDASL.DLL, an ISAPI DLL, parses the packet and sees that it has the proprietary INVOKE command. Because of the existence of this command, the packet is passed off to msdmserv.exe, who in turn processes the packet and uses EXOLEDB to access the WSS, perform the operation and send the results back to the user in the form of XML.

What is CAML?
CAML stands for Collaborative Application Markup Language and is an XML-based languagethat is used in Microsoft Windows SharePoint Services to define sites and lists, including, for Eg, fields, views, or forms, but CAML is also used to define tables in the Windows SharePoint Servies database during site provisioning. Developers mostly use CAML Queries to retrieve data from Lists\libraries.

Can you display\add a Custom aspx or WebApplication Page in SharePoint Context?
You need to make some modification in the aspx file to display it in SharePoint Context. Firstly, add the references for various sharepoint assemblies on the Page. Then wrap the Code in PlaceHolderMain contentPlaceholder, so that it gets displayed as a content page. Lastly, add a reference to SharePoint Master Page in aspx file and swicth it in Code behind if needed. See Code Example at Display aspx Page in SharePoint context.

What is 14 hive in SharePoint?
See SharePoint 2010 Object Model

How would you re-deploy the old custom solutions in SharePoint 2010. What Changes are needed to the old Solution files?
SharePoint 2010 object model contains many changes and enhancements, but our custom code will still compile and, will run as expected. You should however, rewrite and recompile any code that refers to files and resources in "12 hive".

How many types of Client Object model extension are available in 2010 and when would you use one or the other?
To develop rich client side solutions, three set of client-side APIs has been introduced in the Microsoft.SharePoint.Client namespace. The three APIs are targeted for three different types of clients.
  1. .NET Managed applications – These are used when we have to create console applications or window applications, web applications which are not running inside SharePoint Contex.
  2. For Silverlight applications.
  3. ECMAScript – It is a client object model extension for using with JavaScript or JScript. This is used for creating applications which are hosted inside SharePoint. For example, web part deployed in SharePoint site can use this JavaScript API for accessing SharePoint from browser using JavaScript.

What are the security improvements in SharePoint 2010?
In SharePoint 2010 a variety of security methods have been introduced.
Claims-Based Authentication - Claims based authentication is based on identity. and trust.
Code Access Security - In which you can specify your own code access security (CAS) policy for your web parts.
Sandbox Solutions - Sandbox Solutions which when deployed to the server, SharePoint runs in a special process that has limited permissions.
Cross-Site Scripting - Introduced to prevent Cross - Site Scripting (XSS) attacks.

Whats New with SharePoint WebParts?
A developer can create two types of webparts using Visual Studio 2010.
1. Visual Webparts - Allows you to Drag and Drop the controls from the Toolbox to WebPart Design surface. You can of course write your custom code in the code file. You can also package and deploy your webparts directly to Sharepoint from VS by pressing Clt+F5. Visual studio 2010 also provides you with three different views for developing webparts. The views are split view, design view and Source view(as we have in designer 2007).
Note : The Visual Webpart project Item basically loads a User Control as a WebPart.
2. ASP.NET WebParts - Where a developer can build up User Interface and logic in a class file. You do not have designer for drag and drop of controls. This webpart inherits from standard ASP.NET webpart. For Deployment we can again use ctrl+f5 to deploy this webpart.

What are the Visual Studio 2010 Tools for SharePoint?
Visual Studio 2010 includes SharePoint-specific project types and project item types, and includes powerful packaging, deployment, and debugging features that help increase your efficiency as a SharePoint 2010 developer.
Some of the Templates avaiable are:
  1. Visual Web Part project template.
  2. List defination template.
  3. Content Type template.
  4. Empty Project template.
  5. Event Receiver template.
  6. Some workflow template.
  7. The Site Definition template.
and many more....

What are SharePoint Sandboxed soultions?
SharePoint 2010 provides a new sandboxed environment that enables you to run user solutions without affecting the rest of the SharePoint farm. This environment means that users can upload their own custom solutions without requiring intervention from administrators, and without putting the rest of the farm at risk. This means that the existing sites\pages or components will not be effected by the newly added soultion.
Users can deploy the below four things as sandboxed soultions :
  1. 1. WebParts.
  2. 2. Event Receivers.
  3. 3. List Definations.
  4. 4. Workflows.

What are Requirenments for SharePoint 2010?
SharePoint Server 2010 will support only 64 - bit. It will require 64 bit Windows Server 2008 or 64 bit Windows Server 2008 R2. In addition to this, it will require 64 bit version of SQL Server 2008 or 64-bit version of SQL Server 2005.

What is LIN? How is it used in Sharepoint?
LINQ is a feature of the programming languages C# 3.0 and Visual Basic .NET. LINQ allows you to query in an object-oriented way, supports compile-time check, gives you intellisense support in Visual Studio and defines a unified, SQL like syntax to query any data source. But unlike other languages and query syntaxes which vary from one type of data source to another, LINQ can be used to query, in principle, any data source whatsoever. It is commonly used to query objects collections, XML and SQL server data sources.
The LINQ to SharePoint Provider is defined in the Microsoft.SharePoint.Linq namespace. It translates LINQ queries into Collaborative Application Markup Language (CAML) queries.

What Changes are made in SharePoint 2010 to enforce Referential Integrity?
In SharePoint 2010, Referential Integrity is enforced using two options, available with Look-up columns.
While creating a Look-up column, you can either choose a) Restrict Delete or b) Cascade Delete to define a relationship between the Look-up list and the list containing the look-up Column. Read Details at SharePoint 2010 Referential integrity - Using LookUp Column

Whats Ribbon in SharePoint 2010?
Whats New in SPALerts?
In SharePoint 2007, alerts were send only through e-mails, but in SP2010 users can also send an alert to mobile devices as SMS Message. A New property DeliveryChannels is introduced to indicate, whether the alert is delivered as E-mail or as an SMS Message.

What Has Changed with SSP in SharePoint 2010?
In SharePoint 2010 Shared Service Providers (SSP's) are replaced by Service Applications. Services are no longer combined into a SSP. They are running independent as a service application. The service application architecture is now also built into Microsoft SharePoint Foundation 2010, in contrast to the Shared Services Provider (SSP) architecture that was only part of Office SharePoint Server 2007.
A key benefit here is that all services are installed by default and there is no SSP setup.

No comments:

Post a Comment