Wednesday, September 11, 2013

SharePoint 2010 Interview Questions & Answers - Part2

 

CUSTOMIZATION QUESTIONS

1. What is Sandbox solution?

When user writes custom code, the code is not trusted, its failure can influence entire site. So the sandbox solution concept is used. In that case, program is only written for particular site & solution is uploaded in the same site. The solution size limit is decided at the time of site creation & if size increases or code shows bad performance then it will be easy for the administrator to stop the working of solution.

 

2. What can be deployed as a Sandbox solution in SharePoint 2010?

Users can deploy the below four things as sandboxed solutions:

1. WebParts.
2. Event Receivers.
3. List Definitions.
4. Workflows. 

 


3. 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 the efficiency as a SharePoint 2010 developer. Some of the Templates available are:

1. Visual Web Part project template.
2. List definition 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....

 

4. How does Client object model works?

When developer use SharePoint client API’s to perform a specific task, the SharePoint 2010 managed client object model bundles up these uses of the API into XML and sends it to the server that runs SharePoint Foundation. The server receives this request, and makes appropriate calls into the object model on the server, collects the responses, forms them into JavaScript Object Notation (JSON), and sends that JSON back to the SharePoint Foundation 2010 managed client object model. The client object model parses the JSON and presents the results to the application as .NET Framework objects (or ECMAScript objects for ECMAScript).

 

5. How many types of Client Object model extension are available in 2010 and when would a developer 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 Context.
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.

 

6. How does user access ECMAScript object model API’s?

The ECMAScript library is available in a number of JS files in the LAYOUTS folder. The main file among number of .js files is SP.js. When developer includes this file in the APSX page using a ScriptLink control, all other required JS files are loaded automatically. By linking SP.js to the page, the SP namespace is registered. SP is the SharePoint namespace that contains all objects. For debugging purposes, every js file also has a ‘debug’ equivalent in the same folder.

 

7. What are the Authentication methods for the client object model application?

A developer can use three authentication options while working with the Client Object Model in SharePoint 2010:

1. Anonymous
2. Default
3. FormsAuthentication

Developer can specify clientContext.Authentication = Anonymous\Default\FormsAuthentication, If developer do not choose an authentication method in the code, the application will by default start using the client’s Windows Credentials (DefaultCredentials).

 

8. How can a developer write efficient and better performing client object applications?

Developer can always use Lambda expressions in their queries to return only specific properties that will be used in the block. Developer can also use LoadQuery() method and specify multiple levels of properties to load for e.g. while returning specific properties of the lists using LoadQuery(), developer can also specify the fields to return from each list to optimize the data access.

 

9. What is difference between Load() and LoadQuery() methods?

Load method populates the client object directly with what it gets data from the server i.e. a collection object like ListItemCollection etc. but LoadQuery returns the data as a completely new collection in  IEnumerable format.
Other major difference is that the Collections that user load using the Load() method are eligible for garbage collection only when the client context variable itself goes out of scope whereas, in  these collections go out of scope at the end of  IEnumerable<List> list.

 

10. What is difference between Load() and LoadQuery() methods?

Load method populates the client object directly with what it gets data from the server i.e. a collection object like ListItemCollection etc. but LoadQuery returns the data as a completely new collection in  IEnumerable format. Other major difference is that the Collections that user load using the Load() method are eligible for garbage collection only when the client context variable itself goes out of scope whereas, in  LoadQuery() collections go out of scope at the end of  IEnumerable<List> list.

 

11. What is the purpose of calling clientContext.ExecuteQuery()?

ExecuteQuery gives developer the option to minimize the number of roundtrips to the server from the client code. All the components loaded into the clientcontext are executed in one go.

 

12. What is REST?

How it is used in SharePoint 2010? REST (Representational State transfer) is a protocol (powered by ADO.NET services) which is used for getting data out of SharePoint via URL. It is mostly used to access data from SharePoint even when user is not in the SharePoint context.

 

13. What data type does REST return?

REST does not return an object of type SharePoint Site\List. Instead, it returns an XML output.

 

14. Why would a developer use LINQ over CAML for data retrieval?

Unlike CAML, with LINQ to SharePoint provider, developers are working with strongly typed list item objects. For example, an item in the Announcements list is an object of type Announcement and an item on a Tasks list is an object of type Task. Developer can then enumerate the objects and get the properties for their use. In addition, developer can take benefit of LINQ syntax and the LINQ keywords built into C# and VB for LINQ queries.

 

15. What are the Disadvantages of Using LINQ in the Code?

LINQ translates the LINQ queries into Collaborative Application Markup Language (CAML) queries thus adding an extra step for retrieving the items.

 

16. What does AllowUnsafeUpdates do?

If developer is trying to modify Windows SharePoint Services data using code, developer may need to allow unsafe updates on the Web site, without requiring a security validation. For this, developer needs to set AllowUnsafeUpdates property to true.

 

17.  What does RunWithElevatedPrivileges do?

There are certain object models that call another model that require site-administration privileges. To bypass access-denied error, we use RunWithElevatedPrivileges property when a nonprivileged user initiates request. We can successfully make calls into the object model by calling the RunWithElevatedPrivileges method provided by the SPSecurity class.

 

18. How is a Content type deployed? 

Content Type can be deployed and associated with list using feature.

 

19. What is the scope of a content type?

A site content type becomes available to lists and document libraries within the site in which the content type is created and to the lists and document libraries in any child site.

 

20. What is an ancestral type and what does it have to do with content types?

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.

 

21. Can a list definition be derived from a custom content type?

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.

 

22. When creating a list definition, how can a user create an instance of the list?

User can create a new instance of a list by creating an instance.XML file

 

23. What are application pages?

An application page is the best type of page to create, when there is need to add custom code. Application pages are stored on the file system of the front-end Web server in the %Program Files\Common Files\Microsoft Shared\web server extensions\14\TEMPLATE\LAYOUTS directory. They allow in-line code without restriction. They cannot use dynamic Web Parts or Web Part zones or be modified using SharePoint Designer. Application pages are not tracked in the content database. They never run in safe mode. Since application pages must be deployed inside the SharePoint Root directory hence, they cannot be used within sandboxed solutions. 

 

24. When to use application pages?

1. These are generally used as administrative pages.
2. These pages can be used where we want to capture data.
3. These pages can be used for configuration pages.
4. These pages can be used where we want to restrict the users to customize the page.
5. Application pages can be used with any site or site collection or web application on same server.
6. These pages are used when we want to add custom code or inline code to the page.
 

 

25. What is difference between an Application page and a Custom aspx page in SharePoint 2010?

Application Page – Developer would typically use an application page when developer need some content that is merged with SharePoint master page. A master page enables application pages to share the same appearance and behavior as other pages on a site. Application page generally is deployed in _layouts and inherits the look and feel of the site that developer is using.
A Custom .net aspx page on the other hand would need content and master page tags in the page to make it inherit the look and feel of the site.

 

26. How to create a custom master page?

There are multiple ways to create custom master page files

1- By copying and editing existing master page.
2- By SharePoint Designer.
3- By editing minimal.master using editor. 

 

27. How to apply a custom master page?

There are two ways to apply a custom master page

1. Custom Master Page can be deployed using SharePoint Feature by which master page gets uploaded to the master page gallery.
2. Custom master page can be uploaded directly in master page gallery library and apply the same master page using site and system master page option in Site Settings page by selecting Master Page option.

 

28. How to link the custom CSS file in the master page?

Custom CSS files can be linked to the master pages with the help of a class called Sharepoint:CssRegistration

 

 

29. If a developer creates a new CSS file then where should the file be stored?

The css file can be stored in two locations, either in the document library or in the layouts folder.

 

30. How to create custom Themes?

Custom themes can be created for SharePoint by two ways.

1- Creating a theme in Microsoft PowerPoint.
2- Themes can also be created with the help of Visual Studio.

 

31. What does safe control means?

SharePoint application runs in Full Trust mode. For Web Parts to work properly in SharePoint Sites, its entry in web.config file assures Full Trust to SharePoint Site as it is registered in the file as safe.

 

32. What is Custom Control?

Custom controls have a file extension as “.ascx”, and are shared across web applications. There is no visual designer for creating custom controls hence, user cannot drag and drop custom controls.

 

33. What is Content query web part?

Content query web part displays a dynamic set of items based on a query that user build by using a web browser. The query displays selected items. User can set presentation options to determine how these items are displayed on the finished page.

34. How to debug a web part?

A web parts can be debugged in visual studio using following steps.

1. Set the break points 
2. Attach the ASP.Net w3wp.exe process 
3. Debug by tracing, change trace level  in web.config 
< Trace enabled ="true" pageOutput = "true"/>

 

35. Can a modal dialog be displayed from a webpart?

Yes, a modal dialog can be displayed from within a webpart code since it is a JavaScript block that can be registered on the page.

 

36. While creating a Web part, which is the ideal location to initialize the web controls?

Override the CreateChildControls() method to include web controls. Developer can control the exact rendering of the controls by calling the Render method.

 

37. How will developer use WebParts or other solutions created in SharePoint 2007 in SharePoint 2010?

In SharePoint 2010 the 12 hive is now replaced by 14 hive, so developer will rewrite and recompile any code that refers to files and resources in “12″ hive. In addition to developer must recompile custom code written for Windows SharePoint Services 3.0 and Office SharePoint Server 2007 that does not run on IIS

 

38. Can Developer modify the Out-of-Box workflows in SharePoint 2010?

In SharePoint 2010, developer has an option to customize the Out-of-Box workflows. The four most popular workflows in SharePoint Server 2010 —

the Approval,
Collect Feedback,
Collect Signatures,
Publishing Approval workflows

— have been completely rebuilt as declarative reusable workflows, meaning that they are now fully customizable in SharePoint Designer 2010

 

39. When is workflow forms created? And how to customize it?

SharePoint Designer 2010 automatically generates the forms, but user can customize them by going to the settings page for the workflow, in the Forms section, click the form user want to customize. Workflow forms are either InfoPath or ASP.NET pages. They are stored on the SharePoint site with the workflow source files. 


40. Where are the InfoPath forms published in SharePoint?

InfoPath forms are published in the Manage Form Template in Central Administration site or to a list or a form library in a site collection. 

 

41. What is Features in SharePoint?

Feature is a functional component, which contains various SharePoint elements. Features have their own receiver architecture, which allow user to trap events such as when a feature is installed, uninstalled, activated, or deactivated. User can define several element types in features like menu command, template, page instance, event handler, workflow, list instance, list definition, and link commands. Features in SharePoint allow users to easily package up functionality that can be deployed and installed across the server farm. Features provide a mechanism by which user can package the files that a solution needs, such as content types, Web Parts, lists, and site definitions, master page. Inside the Feature, the feature.xml file contains references to all the element manifests within that Feature, pluggable behavior for installing or uninstalling Features within a deployment, pluggable behavior for activating or deactivating Features at a given scope, scoped property bag for storing data required by a Feature within its scope.

 

42. What is the scope of feature activation?

Feature can be activated or deactivated at various scopes throughout a SharePoint instances, such as farm level,
web application level,
site collection level,
web level,  etc.…

 

43. What is the difference between feature definition and feature instance?

The feature definition is the set of source files in the Visual Studio 2010 project that is deployed using a solution package. Once deployed, a feature definition is a set of template files and components that reside on each front-end Web server. A feature instance is what is created when a user activates the feature definition

 

44. What are the minimum files required for a feature?

Every feature directory should contain at least one file namely feature.xml and should be placed in the root of the directory. But a feature directory can contain one or more xml files as well as resource files such as image files, css files or js files. A feature.xml file contains attributes like Id, Title, Description, Version, Scope, Hidden, and ImageURL.

 

45. What is hidden attribute in a feature?

Hidden attribute will take the value of True or False. If it is set to False, after installation the feature definition can be seen by administrators only.

 

46. What is Elements.xml file in Feature in SharePoint 2010?

Elements.xml file contains the actual feature element. It can contain elements like ListInstance, Field, ContentType, ListTemplate, Workflow, WorkflowActions etc.


 

47. What is Feature Receiver in SharePoint 2010, its base class along with the methods that needs to be override?

A Feature Receiver allows user to write event handlers in a managed programming language such as C# or Visual Basic. These event handlers are executed during feature specific events such as feature activation and feature deactivation. The base class is SPFeatureReceiver. The methods to be overridden are: FeatureActivating, FeatureActivated, FeatureDeactivating,FeatureDeactivated etc.

 

48. How are features created?

Feature can be created by creating a new Empty SharePoint project from VS 2010 and then add new item named feature. After user has created the project, right click on the "Features" node in "solution explorer" and "add feature". This will create a new feature with the title "Feature1". User can rename it or leave it as it is. On double clicking the name of the feature, the properties of the feature will appear, such as title, description and the scope. Right click on the "feature1" in solution explorer and click on "Add feature Receiver" to add it. After the file has been created, uncomment (as required) the "on activate" and/or “on deactivate" and put code in there.

 


49. How can a feature be deployed?

There are two ways for deploying a feature
1- WSP builder via Visual Studio and activate solution from central admin.
2- Using STS Command, firstly install and then activate.

 

50. Where the feature receiver file needs to be deployed?

The feature receiver file needs to be deployed in Global Assembly cache (GAC).

 

51. What is a Manifest.xml File in SharePoint 2010?

Manifest.xml file contains the Meta data of a solution package. At the time of deployment, SharePoint inspects manifest.xml file to determine which template files it needs to copy into the SharePoint root directory.

 

52. Can a page be displayed as a modal dialog?

Yes, any page can be displayed as modal dialog. A Modal dialog takes options as a parameter and developer can specify the URL for any page usually saved in _layouts.

 

53. What is New in SPALerts?

In SharePoint 2007, alerts were sent only through e-mails, but in SharePoint 2010, 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.

 

Source: Vishal Gupta SharePoint Interview Questions

SharePoint 2010 Interview Questions & Answers

 

BASIC INTERVIEW QUESTIONS:

In this blog post we will be sharing Interview Questions related to Microsoft SharePoint 2010. Let’s start from the basic to the most advanced interview questions.

 

1. What is SharePoint 2010?

SharePoint was born out of a simple idea: “Sharing Documents”. Microsoft developed family of `software products called “SharePoint”, to perform features like File Sharing, Collaboration, and Web Publishing. In simple terms, SharePoint acts as the single platform to share, communicate, store, and collaborate the content, documents, and records.

 

2. What does SharePoint 2010 family of products consists of?

  1. SharePoint Foundation 2010
  2. Search Server 2010 Express
  3. SharePoint Server 2010 
  4. Search Server 2010
  5. FAST™ Search Server 2010 for SharePoint
  6. SharePoint Designer 2010

 

3. What are the new features in Sharepoint?

1- Access Services: Use Access Services in Microsoft SharePoint Server 2010 to edit, update, and create linked Microsoft Access 2010 databases that can be viewed and manipulated by using an Internet browser.
2- Business Connectivity Services: SharePoint Server 2010 include Microsoft Business Connectivity Services, which is a set of services and features that provide a way to connect SharePoint-based solutions to sources of external data and to define external content types based on that external data
3- Central Administration: Central Administration has been redesigned in SharePoint Server 2010 to provide a more familiar experience
4- Digital Asset Management: SharePoint Server 2010 includes a new asset library specially designed for managing and sharing digital assets such as audio, video, and other rich media files. 5- Enterprise Search (Fast Search): With the new capabilities in SharePoint Server 2010, search administrators can configure an optimal search infrastructure that helps end users find information in the enterprise quickly and efficiently.
6- Excel Services: Excel Services in SharePoint 2010 can be used to publish Excel client workbooks on SharePoint Server 2010
7- Health Monitoring: SharePoint Server 2010 includes an integrated health analysis tool called SharePoint Health Analyzer that enables SharePoint Server to automatically check for potential configuration, performance, and usage problems
8- Managed Metadata: The Managed Metadata Service supports the use of managed metadata, as well as the sharing of content types across the enterprise.
9- Performance Point Services: Performance Point Services in Microsoft SharePoint Server 2010 provides flexible, easy-to-use tools for building dashboards, scorecards, and key performance indicators (KPIs
10- Records Management: In SharePoint Server 2010, user can manage records in an archive, or can manage records in the same document repository as active document
11- Sandboxed Solutions: User can deploy sandboxed solutions to quickly and more securely solve business problems. Sandboxed solutions are like farm solutions except in the following ways: they are rights-restricted and have a more permissive deployment policy than farm solutions; they are limited to the site collection to which they are deployed;
12- Social Computing: SharePoint Server 2010 includes social networking tools such as My Site Web sites and social content technologies such as blogs, wikis, and really simple syndication (RSS). These features are built upon a database of properties that integrates information about people from many kinds of business applications and directory services
13- Upgrade:  
13.1: Visual Upgrade: A new feature that is available with upgrade allows the server administrator or site owner to determine when and if the new look for SharePoint Server 2010 is used for a particular site collection. Server administrators can choose to adopt the new look and feel for all sites during upgrade, let site owners make the choice after upgrade, or keep the old look and feel for all site
13.2: Feature Upgrade: SharePoint Foundation 2010 provides new members and types that make it possible for user to upgrade custom Features through versioning and declarative upgrade actions. User can update any Features created for Office SharePoint Server 2007 to work with SharePoint Server 2010 by using these members.
14- Visio Services: The Visio Graphics Service is a service on the SharePoint Server 2010 platform that enables users to share and view Visio diagrams and enables data-connected Microsoft Visio 2010 diagrams to be refreshed and updated from a variety of data source
15- Windows Power Shell: Windows Power Shell is the new command-line interface and scripting language specifically designed for Admin
16- Client Object Model: Microsoft SharePoint Foundation 2010 introduces three new client APIs for interacting with SharePoint sites: from a .NET managed application, from a Microsoft Silverlight or from ECMAScript (JavaScript, JScript) that executes in the browser. The new client object models provide an object-oriented system for interoperating with SharePoint data from a remote computer easier to use existing SharePoint Foundation Web services

 

 

4. What are the various built in columns available in SharePoint 2010?

1. Single line of text
2. Multiple lines of text
3. Choice (menu to choose from)
4. Number (1, 1.0, 100)
5. Currency ($, ¥, €)
6. Date and Time
7. Lookup (information already on this site)
8. Yes/No (check box)
9. Person or Group
10. Hyperlink or Picture
11. Calculated (calculation based on other columns)
12. Full HTML content with formatting and constraints for publishing
13. Image with formatting and constraints for publishing
14. Hyperlink with formatting and constraints for publishing
15. Summary Links data
16. Rich media data for publishing
17. Managed Metadata

 

5. What is Content Type?

A content type is a reusable collection of metadata (columns), workflow, behavior, and other settings for a category of items or documents. Content types enable user to manage the settings for a category of information in a centralized and reusable manner. A content type defines the attributes of a list item, a document, or a folder. Each content type can specify properties to associate with items of its type.

 

6. What is Document Set?

Document Set enables users to group multiple documents that support a single project or task, together into a single entity. All documents in a Document Set share the metadata and the entire set can be versioned. Document sets are built on SharePoint 2010 content types, and user can create multiple unique document set content types as part of their implementation. 

 

7. What is Drop-Off Library?

The Drop Off Library will be the default destination when a user tries to upload a document to this site. This is used when user does not know that where should the document be uploaded in the site. In that case, user uploads the document in this library and the document is routed automatically to the specific library.

 

8. What is Routing Rules List?

The Routing Rules list, as its name implies, contains the rules for how a document is to be routed to its final destination. These rules are written to route the documents to their final and proper destination.

 

9. What is enterprise Metadata Management?

Enterprise metadata management (EMM) is a set of features introduced in Microsoft SharePoint Server 2010 that enable taxonomists, librarians, and administrators to create and manage terms and sets of terms across the enterprise. There are two key principles in the use of metadata:

1. Use of tags: It is easy for a site to use enterprise wide tags and taxonomies, and easy for users to apply them.
2. Application of tags in SharePoint 2010: The document libraries are configured to use metadata as a primary navigation pivot and improves search.

 

10. What is Web part? 

Web Parts are customizable plug and play components that empower information workers to create personalized user interfaces by simply dragging and dropping them on a Web page. Web parts allow customization at both design time and run time.

There are two types of web parts.
1. In-built web parts – Web parts that are included in SharePoint. Developers can drag them from web part galleries and drop them into web part zones.
2. Custom web parts – Web parts that are created by the user using visual studio is called custom web parts. 


A Web Part is composed of the following entities:
1. The Web Part description file (.dwp) is a portable container of default and personalized property values for the Web Part.
2. The Web Part assembly file (.dll) contains the logic and code for the Web Part, and is installed on the server running Windows SharePoint Services.
3. Resource files that support the Web Part; these are also stored on the server.
4. Tables in the Windows SharePoint Services database are used to store current values of the Web Part properties.

 

11. What are the various types of master pages?

There are three types of master pages in SharePoint 2010:

1-  V4.master Default team site master page. Provides ribbon bar and other editing features using UI.

2-  Default.master Sites upgraded from SharePoint 2007 use this unless they are changed to use a v4 version.

3- Minimal.master These trimmed-down custom master pages are commonly referred to as Starter Master Pages in SharePoint 2010.

 

12. What are Content pages?

Content pages implement a master page. Content pages contain an attribute, which informs the compiler that the page should be, merged with a master page. This attribute is part of the page directive tag called the MasterPageFile. 


13. What is Page Layout? 

Page layout dictates the overall look and feel of a web page. A page layout relies on a content type to determine the kind of content that can be stored on pages. Page layout contains field controls and web part. 

14. What is Site definition? 

Site definitions are the foundations on which all sites and user templates are built. These are the collection of XML or ASPX files. Site definition contains information of web parts, lists, libraries, features, and navigation bars to be included in the site

15. What is Site template?

A site template provides the basic component and layout of a new site created under SharePoint. A site template contains specific design information about a site, including the list that is part of the site, web part pages used in the site, the site’s themes and borders, changes to the quick launch bar, as well as some site content (such as document libraries). Site templates are used to allow the rapid creation of websites and basic content in a SharePoint system.

 

16. What is ONET.xml?

ONET.xml file is present in TEMPLATE\SiteTemplates\XML\Onet.xml location, which defines the setup of the site definition, such as which Features to load, where the web parts go and what they will perform and which document library templates to assign and many more.

 

17. What is Single sign-on?

Single Sign-on allows users to log on to a variety of applications with the single username and password and user has to enter the details only once for all the applications.

 

 

Source: Vishal Gupta SharePoint Interview Questions

Thursday, August 22, 2013

SharePoint Foundation 2013 Preview and Windows 8

 

I recently installed Windows8.1 and was planning to install SharePoint 2013 just like I had installed SharePoint 2010 on Windows 7 but it was heart-threatening to know that SharePoint 2013 can only be installed on Windows Server 2008 R2, or Windows Server 2012 Release Candidate.

Other hardware and Software requirements to install SharePoint 2013 can be obtained by clicking here.

Also you can Virtualizes Windows 8 environment and can install SharePoint 2013. Click here to see the steps to enable Hyper-V support in Windows8.

Thursday, November 1, 2012

HTTP/1.1 200 OK Server: Microsoft-IIS/7.5 Error

 

This is an error that I was facing while I try open a SharePoint URL on a browser. I know its really stupid to post such a stuff but I believe that most of the users do face this error when they try to open the site just after creating a new Web Application. The reason behind getting this error is that the SharePoint Central Admin does have the Web Application but has no Site Collection to publish; which results in an error given below:

HTTP/1.1 200 OK Server: Microsoft-IIS/7.5 Date: <DATE> GMT Connection: close 

To get rid of this error you just have to create a Site Collection and you are done. ;)

Friday, October 26, 2012

The Module SharePoint Project Item type

 

The SharePoint Developer Tools provide a SharePoint Project Item Type named Module, which
provides a layer of productivity on top of the CAML-based Module element. You can add a
new Module SharePoint Project Item Type to a SharePoint project using the Add New Item
dialog of Visual Studio 2010.

Add New Item SharePoint 2010

In addition to provisioning objects within the top-level site, activation of the
MainSite feature creates a simple navigation scheme by adding four links to the top link bar.
This is accomplished in the FeatureActivated method by using the server-side object model
to add four new SPNavigationNode objects to the TopNavigationBar property of the current
SPWeb object’s Navigation property.

public override void FeatureActivated(SPFeatureReceiverProperties properties)
        {
            SPSite oSPSite = new SPSite("http://amit-pc");
            //Open Sharepoint Site
            SPWeb oSPWeb = oSPSite.OpenWeb();
            oSPWeb.AllowUnsafeUpdates = true;

            // create menu for custom site pages
            SPNavigationNodeCollection topNav = oSPWeb.Navigation.TopNavigationBar;
            topNav.AddAsLast(new SPNavigationNode("Page 1", "Module1/Sample.txt"));
            topNav.AddAsLast(new SPNavigationNode("Page 2", "Module1/Sample.txt"));
            topNav.AddAsLast(new SPNavigationNode("Page 3", "Module1/Sample.txt"));
            topNav.AddAsLast(new SPNavigationNode("Page 4", "Module1/Sample.txt"));
        }

using the above given code we can get the navigation in the site as shown in the below given figure:

SharePoint 2010

Thursday, October 25, 2012

SharePoint Master Pages

I believe that you all might be aware of the concept of Master Pages in .NET and SharePoint 2007. The obvious benefit of Master pages is that all the pages in a SharePoint site can link to a single Master Page to achieve a consistent look and feel.

Enhancements were made in SharePoint 2010 so that single master page can be used with both Site Pages and Application Pages.

Whenever SharePoint foundation provisions a new site, it creates a special hidden document library known as Master Page Gallery; and creates three new Master Page instances:

  • v4.Master
  • minimal.master
  • default.master

v4.Master: This is the primary master page used in SharePoint 2010 sites. Ex: Team Site Master page. It includes element such as Site Actions menu, the breadcrumb trail, the Ribbon, the welcome menu, the site icon, the topNav bar and the quick launch.

minimal.master: minimal.master is a page layout without any of the chrome that is included in v4.master.

default.master: default.master is a master page designed to support a feature known as visual upgrade, which assists in upgrading SharePoint 2007 sites to run within SharePoint 2010 farms.

Differentiating between Site Pages and Application Pages

 

Whenever you need to design SharePoint Solutions you will find the requirement for creating pages to a site. Therefore you must be knowing the fundamental difference between Site Pages and Application Pages so that you can decide which one to use and when. Therefore in this post I am trying to summarize the difference between the two.

Advantages Site Pages
Site Pages support customization through the browser and with SharePoint designer 2010. Example of Site Pages is NewForm.aspx, AllItems.aspx, EditForm.aspx.

Disadvantages Site Pages
Site Pages require elaborate processing infrastructure that has implications on security, performance and scalability. Also the Site Pages run in Safe Mode and hence its not possible to write inline code. Each customized page instance must be loaded separately into memory.

Advantages Application Pages
Application pages do not support customization, this gives them a few distinctive advantage over Site Pages:

  • First, they can be used in scenarios where we don’t want to give the control to user to edit the page.
  • Second, they do not run in safe mode and hence inline coding is possible
  • Third, each Application page is compiled into a single assembly DLL, this makes it perform better and scalable then site pages that can be customized.

Disadvantages Application Pages
Application pages are deployed inside the SharePoint root directory, which means that they cannot be used in Sandbox Solution.