Tuesday, June 22, 2010

Sharepoint interview Questions

1. What are Application Pages in SharePoint?

Application Pages

SitePages

1. 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

1.Site Pages Can be site specific WE Can manage different site pages for different Sites.

2. Application pages are based in the virtual _layouts directory. In addition, they are compiled into a single assembly DLL.

2. Site Pages stores in Content DB and can be retrieved by WSS File Provider Using Safe mode Parser.

3. With application pages, you can also add inline code.

3.You can’t add any inline code

4. 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).

4.Example is default.aspx and all webpages created in site .


2. Which is Better a UserControl or WebPart?
Ans: Advantages of Using User Control are :
Advantages of User control
There are three primary advantages to user controls when dealing with SharePoint. They are: familiarity, reusability, and development speed.
*Familiarity:
One of the keys to development is managing the degree of change that the team is put through as it transitions from technology to technology. Part of managing that change is minimizing it where possible. This is one of the reasons that user controls are such a good solution for many organizations. User controls are a core ASP.NET construct, they are something that developers are likely already familiar with — or at least aware of. This familiarity increases the knowledge reuse coming into the project, which keeps morale high, improves productivity, and improves reuse of the experience after the SharePoint project.

*Reusability
Another way user controls are advantageous is that they can be used with other ASP.NET-based solutions. They aren't explicitly tied to SharePoint. If for some reason in the future you decide that SharePoint isn't the right platform for the solutions you're building — or you decide you need to reuse the technology in another non-SharePoint project — you have that capability.

*Development Speed:
Direct support by Visual Studio for a visual interface for user controls — as opposed to manually adding in controls through code — is a great advantage in development speed. Having a visual look and feel instantly available makes the process go faster.

*Debugging is faster too, as you can construct testing harnesses that fully exercise and instrument the user control. Web Parts are essentially only runable from within SharePoint. This means that you must deal with all of the SharePoint infrastructure while trying to debug.
Maintenance is also easier and faster with User Controls, primarily because they are easier to understand and debug. The net of this is that developing with user controls is substantially faster than developing a Web Part for everything but the most trivial implementations

3. When to use Diffrent Site Collections?
Ans. An Individual Site collection offers following :
For the Users:
Dedicated Recycle bins
Dedicated usage Reports
Distributed administration (site collection administrators)
Dedicated search scopes, keywords, and best-bets
Custom feature deployments
Dedicated language translation maintenance
Dedicated galleries for web parts, master pages, content types, site columns, site templates, and list templates
Dedicated shared libraries, such as site collection images and site collection styles
Dedicated real estate (Self Containment)

For the IT Administrators:
Site quota templates
Distributed administration
Site locking
Database maintenance options
Backup / Restore abilities
Content Deployments
InfoPath forms services global template targeting

4. Why to use diffrent site collections:
Ans. Following are the resons:
1. Site quotas is one of the reasons. The issue is the recycle bin is based on site collections and the quota for a site collection. If everyone shares a site collection, then they share the recycle bins storage size.

2. Delegated Security and distributed administration is the next big thing. For eg, you have a IT department that doesn't know who should be able to see what content, besides how it should be organized. This is the job of the content owners and users. SharePoint site collections offers IT the ability to create a site collection for a project, team, department, document, or whatever the needs are, then assign an owner and hand it off to them.

3. In addition to these two points is the need to separate the content between databases.

5. What is Authentication and Authorization.
Ans : 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.

6. What are Security methods(Authentication methods) available in sharepoint.
Ans : "Out of the box", SharePoint 2007 supports nine authentication methods. NTLM (short for NT Lan Manager, which is simply the Windows authentication that everyone is familiar with) and Kerberos (also a Windows "standard" authentication) are offered during installation, but I recommend to get started with NTLM, as Kerberos requires "special configuration by the domain administrator", while NTLM works without further hassle.

7. What is the relationship between Microsoft SharePoint Portal Server and Microsoft Windows Services?
Ans. Microsoft SharePoint Products and Technologies (including SharePoint Portal Server and Windows SharePoint Services) deliver highly scalable collaboration solutions with flexible deployment and management tools. Windows SharePoint Services provides sites for team collaboration, while Share Point Portal Server connects these sites, people, and business processes-facilitating knowledge sharing and smart organizations. SharePoint Portal Server also extends the capabilities of Windows SharePoint Services by providing organizational and management tools for SharePoint sites, and by enabling teams to publish information to the entire organization.

8. What is a SharePoint Feature? What files are used to define a feature?
Ans. 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.
The element types that can be defined by a feature include
menu commands, link commands, page templates, page instances, list definitions, list instances,
event handlers, and workflows.

The two files that are used to define a feature are the feature.xml and manifest file(elements.xml). The feature XML file defines the actual feature and will make SharePoint aware of the installed feature. The manifest file contains details about the feature such as functionality.

9. Workflow can be applied to what all elements of SharePoint ?
Ans. Workflow associations are often created directly on lists and libraries, a workflow association can also be created on a content type that exists within the Content Type Gallery for the current site or content types defined within a list. In short, it can be applied ...
At the level of a list/library
At the level of a content type defined at site scope
At the level of a content type defined at list scope

10. What are the types of input forms that can be created for a workflow ?
Ans. You can create four different types of input forms including
1. An association form
2. An initiation form
3. A modification form
4. A task edit form.

Note that these forms are optional when you create a workflow template.

11. What are ways to create input forms for workflow ?
Ans. 1. You can create your forms by using custom application pages, which are standard .aspx pages deployed to run out of the _layouts directory. ( disadv: lot of code required when compared to Infopath approach)
2. Using Microsoft Office InfoPath 2007 (disadv: picks up a dependenct on MOSS, i.e. it cannot run in a standalone WSS environment)

12. What is the difference between method activity and event activity in WorkFlow ?
Ans. A method activity is one that performs an action, such as creating or updating a task. An event activity is one that runs in response to an action occurring.

13. What are content types?
Ans. 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.

14. Can a content type have receivers associated with it?
Ans. 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.

15. What two files are typically (this is kept generally) included when developing a content type, and what is the purpose of each?
Ans. There is generally the main content type file that holds things like the content type ID, name, group, description, and version. There is also the ContentType.Fields file which contains the fields to include in the content type that has the ID, Type, Name, DisplayName, StaticName, Hidden, Required, and Sealed elements. They are related by the FieldRefs element in the main content type file.

16. What is an ancestral type and what does it have to do with content types?
Ans. An ancestral type is the base type that the content type is deriving from, such as Document (0x0101). The ancestral type will define the metadata fields that are included with the custom content type.

17. Can a list definition be derived from a custom content type?
Ans. Yes, a list definition can derive from a content type which can be seen in the schema.XML of the list definition in the element.

18. When creating a list definition, how can you create an instance of the list?
Ans. You can create a new instance of a list by creating an instance.XML file

19. What is a Field Control?
Ans. Field controls are simple ASP.NET 2.0 server controls that provide the basic field functionality of SharePoint. They provide basic general functionality such as displaying or editing list data as it appears on SharePoint list pages.

20. What base class do custom Field Controls inherit from?
Ans. This varies. Generally, custom field controls inherit from the Microsoft.SharePoint.WebControls.BaseFieldControl namespace, but you can inherit from the default field controls.

21. Can multiple SharePoint installs point to the same DB?
Ans. Multiple SharePoint installs can use the same database server. Not literally the same database on that server. That server must be SQL Server 2000 or SQL Server 2005. It cannot be Oracle or another vendor.

22. How to create links to the mapped network drives?
Ans. Creating links to mapped drives in WSS v3 or MOSS 2007 can be done via
the new content type for .lnk files.

23. While creating a Web part, which is the ideal location to Initialize my new controls?
Ans. 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.

24. What are the two base classes a WebPart you are going to use within SharePoint 2007 can inherit from?
Ans. There are two base classes that a WebPart which is going to be consumed by SharePoint can inherit from, either the
SharePoint WebPart Base class
or the
ASP.NET 2.0 WebPart base class.
When inheriting from the SharePoint WebPart Base class your derived WebPart class will inherit from Microsoft.SharePoint.WebPartPages.WebPart. When inheriting from the ASP.NET 2.0 WebPart base class your derived WebPart class will inherit from System.Web.UI.WebControls.WebParts.WebPart. It is considered good practice to use the ASP.NET WebPart base class since the old base class is meant for backwards compatibility with previous version of SharePoint, however there are four exception when it is better to leverage functionality from the SharePoint WebPart base class:
Cross page connections
Connections between Web Parts that are outside of a Web Part zone
Client-side connections (Web Part Page Services Component)
Data caching infrastructure

25. What is the WebPartManager sealed class? What is its purpose?
Ans. The WebPartManager sealed class is responsible for managing everything occurring on a WebPart page, such as the WebParts (controls), events, and misc. functionality that will occur in WebPartZones. For example, the WebPartManager is responsible for the functionality that is provided when you are working with moving a WebPart from WebPartZone to WebPartZone. It is known as the “the central class of the Web Part Control Set.”

26. What does AllowUnsafeUpdates do ?
Ans. If your code modifies Windows SharePoint Services data in some way, you may need to allow unsafe updates on the Web site, without requiring a security validation. You can do by setting the AllowUnsafeUpdates property.

27. What does RunWithElevatedPrivileges do?
Ans. There are certain object model calls model that require site-administration privileges. To bypass access-denied error, we use RunWithElevatedPrivileges property when request is initiated by a nonprivileged user. We can successfully make calls into the object model by calling the RunWithElevatedPrivileges method provided by the SPSecurity class.

28. What does SPWeb.EnsureUser method do?
Ans. Checks whether the specified login name belongs to a valid user of the Web site, and if the login name does not already exist, adds it to the Web site.
e.g SPUser usr = myWeb.EnsureUser("user");

29. What is a SPSite and SPWeb object, and what is the difference between each of the objects?
Ans. The SPSite object represents a collection of sites (site collection [a top level site and all its subsites]). The SPWeb object represents an instance SharePoint Web, and SPWeb object contains things like the actual content. A SPSite object contains the various subsites and the information regarding them.

30. What does a SPWebApplication object represent?
Ans. The SPWebApplication objects represents a SharePoint Web Application, which essentially is an IIS virtual server. Using the class you can instigate high level operations, such as getting all the features of an entire Web Application instance, or doing high level creation operations like creating new Web Applications through code.

31. Would you use SPWebApplication to get information like the SMTP address of the SharePoint site?
Ans. Yes, since this is a Web Application level setting. You would iterate through each SPWebApplication in the SPWebApplication collection, and then use the appropriate property calls (OutboundMailServiceInstance) in order to return settings regarding the mail service such as the SMTP address.

32. How do you return SharePoint List items using SharePoint web services?
Ans. 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.
Side Question: I got asked how I built queries with the lists.asmx web service. In order to build queries with this service, one of the parameters that the GetListItems method exposes is the option to build a CAML query. There are other ways to do this as well, but that was how I answered it.

33. When retrieving List items using SharePoint Web Services, how do you specify explicit credentials to be passed to access the list items?
Ans. In order to specify explicit credentials with a Web Service, you generally instantiate the web service, and then using the credentials properties of the Web Service object you use the System.Net.NetworkCredential class to specify the username, password, and domain that you wish to pass when making the web service call and operations.

34. What is CAML, and why would you use it?
Ans. CAML stands for Collaborative Application Markup Language. CAML is an XML based language which provides data constructs that build up the SharePoint fields, view, and is used for table definition during site provisioning. CAML is responsible for rending data and the resulting HTML that is output to the user in SharePoint. CAML can be used for a variety of circumstances, overall is used to query, build and customize SharePoint based sites. A general use would be building a CAML query in a SharePoint WebPart in order to retrieve values from a SharePoint list.

35. What is impersonation, and when would you use impersonation?
Ans. Impersonation can basically provide the functionality of executing something in the context of a different identity, for example assigning an account to users with anonymous access. You would use impersonation in order to access resources on behalf of the user with a different account, that normally, that wouldn’t be able to access or execute something.

36. What are WebPart properties, and what are some of the attributes you see when declaring WebPart properties in code?
Ans. WebPart properties are just like ASP.NET control properties, they are used to interact with and specify attributes that should be applied to a WebPart by a user. Some of the attributes you see with ASP.NET 2.0 properties are WebDescription, WebDisplayName, Category, Personalizable, and WebBrowsable. Although most of these properties come from the System.Web.UI.WebControls.WebParts class, ones like Category come out of System.ComponentModel namespace.

37. Why are properties important in WebPart development, and how have you exploited them in past development projects? What must each custom property have?
Ans. Properties are important because WebParts allow levels of personalization for each user. WebPart properties make it possible for a user to interact, adjust, and increase overall experience value with the programmatic assets that you develop without having the need to use an external editor or right any code. A very simple example of exploiting a property would be something like allowing the user to change the text on the WebPart design interface so that they can display whatever string of text they desire.
Each custom property that you have must have the appropriate get and set accessor methods.

38. What are ClassResources? How do you reference and deploy resources with an ASP.NET 2.0 WebPart?
Ans. ClassResources are used when inheriting from the SharePoint.WebPart.WebPartPages.WebPart base class, and are defined in the SharePoint solution file as things that should be stored in the wpresources directory on the server. It is a helpful directory to use in order to deploy custom images. In ASP.NET 2.0, typically things such as images are referenced by embedding them as resources within an assembly. The good part about ClassResources is they can help to eliminate recompiles to change small interface adjustments or alterations to external JavaScript files.

39. What is a SharePoint Solution File? How does it differ from WebPart .cab files in legacy development? What does it contain?
Ans. A SharePoint solution file is essentially a .cabinet file with all a developers ustom componets suffixed with a .wsp extension that aids in deployment. The big difference with SharePoint solution files is is that a solution:
allows deployment to all WFE’s in a farm
is highly manageable from the interface allowing deployment, retraction, and versioning
Can package all types of assets like site definitions, feature definitions (and associated components), Webparts, etc.
Can provide Code Access Security provisioning to avoid GAC deployments
And much more..


40. What is a .ddf file and what does it have to do with SharePoint Solution creation?
Ans. A .ddf file is a data directive file and is used when building the SharePoint solution bundle specifying the source files and their destination locations. The important thing for someone to understand is that the .ddf file will be passed as a parameter to the MAKECAB utility to orchestrate construction of the SharePoint solution file.

41. What file does a SharePoint solution package use to orchestrate (describe) its packaged contents?
Ans. The solution Manifest.XML file.

42. What deployment mechanism can you use to instigate Code Access Security attributes for your WebParts?
Ans. SharePoint solution files can add in order to handle code access security deployment issues. This is done in the element in the SharePoint solution manifest.XML, which makes it easier to get assemblies the appropriate permissions in order to operate in the bin directory of the web application.

43. What are event receivers?
Ans. 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.

44. When would you use an event receiver?
Ans. 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.

45. What base class do event receivers inherit from?
Ans. Event receivers either inherit from the SPListEventReciever base class or the SPItemEventReciever base class, both which derive from the abstract base class SPEventReceiverBase.

46. If I wanted to not allow people to delete documents from a document library, how would I go about it?
Ans. You would on the ItemDeleting event set: properties.Cancel= true.

47. What is the difference between an asynchronous and synchronous event receivers?
Ans. 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


48. Workflow can be applied to what all elements of SharePoint ?
Ans. While workflow associations are often created directly on lists and document libraries, a workflow association can also be created on a content type that exists within the Content Type Gallery for the current site or content types defined within a list. In short, it can be applied ...
At the level of a list (or document library)
At the level of a content type defined at site scope
At the level of a content type defined at list scope

49. What are the ways to initiate the workflow ?
1. Automatic
2. Manual (standard WSS UI interface)
3. Manual (Custom UI Interface)

50. What are the types of input forms that can be created for a workflow ?
Ans. You can create four different types of input forms including an association form, an initiation form, a modification form, and a task edit form. Note that these forms are optional when you create a workflow template.

51. While creating a Webpart, which is the ideal location to Initialize my new controls ?
Ans. Override the CreateChildControls method to include your new controls. To make sure that the new controls are initialized.. call 'EnsureChildControls' in the webparts Render method. You can control the exact Rendering of your controls by calling the .Render method in the webparts Render method.

52. How to query from multiple lists ?
Ans. Use SPSiteDataQuery to fetch data from multiple lists.

53.How Does SharePoint work?
Ans. 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.

54. What is the difference between Syncronous & Asyncronous events?
Syncronous calls ending with 'ing'
E.g. ItemDeleting
Event Handler code execute BEFORE action is committed
WSS waits for code to return
Option to cancel and return error code

Asyncronous calls ending with 'ed'
E.g. ItemDeleted
Event Handler code executes AFTER action is committed
WSS does not wait for code to return
Executed in its own Worker thread.

55. What is ServerUpdate() ?
Ans. Any changes in the list, i.e. new addition or modification of an item.. the operation is complete by calling the Update method.
But if a List is set to maintain versions .. and you are editing an item, but don't want to save it as a new version, then use the SystemUpdate method instead and pass in 'false' as the parameter.

56. What is query.ViewAttributes OR How can you force SPQuery to return results from all the folders of the list?
Ans. If you use SPQuery on any SPlist .. it will bring back results from the current folder only.
If you want to get results from all the folders in the list.. then you need to specify the scope of the query by the use of ViewAttributes..
e.g. query.ViewAttributes = "Scope=\"Recursive\"";

3 comments:

  1. good collections ,
    could you please answer this ,
    how can u make sure in a document library user can see only his items, making view by using [Me] will restrict only view wise , but if users knows the other documents URL he can see other documents , is ther any direct solution for this .

    Thanks in advance
    Vikash

    ReplyDelete
  2. Its excellent collection of all 2007 and 2010 concepts....


    it has more useful to me u r posts..

    thanks

    chittibabu

    ReplyDelete
  3. Hi

    I like this post:

    You create good material for community.

    Please keep posting.

    Let me introduce other material that may be good for net community.

    Source: Project management interview questions

    Best rgs
    Peter

    ReplyDelete

Sharepoint