Saturday, 4 October 2014

Page development in Sharepoint


Bydefault Sharepoint server has two types of pages. 1.Page(Wiki) 2.Web Part Page

1.Page: This is a normal wiki page. In this page we can add text, images, links, ..
2.Web Part Page : This is also a page but here we can't create any text. Only for adding webparts to the page.

We have another type of page is called Publishing page. This is the combination of both page and webpart. If we want to create publishing page means first we should show this option in page list like below.

SiteActions --> SiteSettings --> SiteActions --> ManageSiteFeatures -->  SharePoint Server Publishing ----> Activate. Now you will find the option Publishing page.


==================================

Webpart Page
SiteActions --> MoreOptions --> Page ---> Web Part Page ---> Create --> 
i.Name : SPDemoPage .... Check/uncheck :Overwrite if file already exists? 

ii.Layout : Select a layout template to arrange Web Parts in zones on the page. Multiple Web Parts can be added to each zone. Specific zones allow Web Parts to be stacked in a horizontal or vertical direction, which is illustrated by differently colored Web Parts. If you do not add a Web Part to a zone, the zone collapses (unless it has a fixed width) and the other zones expand to fill unused space when you browse the Web Part Page.
   Choose any one layout template. 
Ex.Header, Footer , 3columns  / Full page, Vertical / Header leftcol, body 

iii.Save Location : Select the document library where you want the Web Part Page to be saved.  choose any one of the following
SiteAssets / Shared Documents / SitePages

A new webpart page will be opened. now you can add webparts by click on Add a web part. 
After adding webparts to the page then click on Stop Editing option. Now page is ready.
*While adding webparts you can also drag webparts from one place to another place.

Web part  zone is like div tag in asp.net / html.
We can add / delete or move webparts from one place to another place.

Publishing Page
This page is the combination of wiki page and web part page. We have 5 types of publishing pages available. Those are
1.Articles 
2.Wiki Page 
3. Project 
4. Redirect 
5. Welcome

SiteActions --> MoreOptions --> Page ---> Publishing Page --> Create --> 
1.Page Title and Description : Enter a URL name, title, and description for this page.   

2.Page Layout : Select a page layout to control how the page will be displayed. 
  i.(Article page) body only: The article page with body only contains a rich text field.
 ii.(Article page) Image on left : The article page with image on left contains an image field and a rich text field
iii.(Article page) Image on right :The article page with image on right contains an image field and a rich text field.
iv.(Article page) Summary Links : The article page with links contains an image field and summary links. 

v.(Enterprise Wiki Page) Basic page:A basic page layout containing a single content area.

vi.(Project Page) Basic Project Page:A basic page layout containing a single content area.

vii.(Redirect Page)Redirect : This page layout contains a redirect control for automatically directing readers to any specified URL.

viii.(Welcome Page) Blank Web part page: Page layout for creating web part pages
ix.(Welcome Page)Splash : The welcome with splash contains an image field on left, a rich text field and Web Part zones arranged in a header, and 2 columns.  The left navigation pane is hidden.
x.(Welcome Page) Summary Links :The welcome page with summary links contains an image field on left, a rich text field, 2 summary links, and Web Part zones arranged in a header, a footer, and 2 columns.
xi.(Welcome Page) Table of contents: The welcome page with table of contents contains an image field on left, a rich text field, a table of contents Web Part, and Web Part zones arranged in a header, a footer, and 2 columns.

Click on Create.
Now you can add text, images ..... after completion of creating Save the page then click on Publish --> Publish ---> Enter any comments if ... Continue click

While you are developing the publishing page its status is 'Checked out' Means it is under design. So no one cant access this page. 

Like you can create all publish pages of enterprisewiki, basic project page, redirect page and welcome page.

============================================================

Tuesday, 23 September 2014

Sharepoint Realtime Interview questions

Important interview questions for Sharepoint Developer
Q. How will you deploy files such as Css, js in SharePoint 2010?
Ans. The most preferable way to deploy files in SharePoint is by using the solution package. In SharePoint 2010 you can create an empty project with VS 2010 and then add a new SharePoint Mapped folder  in it. This will give the desired location in 14 hive where you can then add a file to deploy.

Q. Can you display a page as a modal dialog?
Ans. Yes, any page can be displayed as modal dialog. A Modal dialog takes options as a parameter and we can speciy the url for any page usually saved in _layouts.

Q. Can you display the modal dialog from a webpart?
Ans. Yes a modal dialog can be displayed from within a webpart code since its a JavaScript block that can be registered on the page.

Q. What is difference between an Application page and a Custom aspx page in SharePoint 2010. If you have to deploy a page with some code in it which one would you prefer?
Ans.
Application Page – You would typically use an applictaion page when you 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 gets deployed in _layouts and inhertirs the look and feel of the site that you are using.
A Custom .net aspx page on the other hand would need content and master page tags in your page to make it inherit the look and feel of the site.
I would prefer deploying an application page with code as it is much easier and has built-in templates available in VS 2010.

Q. What is Docuement Set and how is it useful to the end users?
Ans. A Document Set is a group of related documents that can be created in one step and then managed as a single entity. This can be seen as a folder of documents with a cover letter(welcome page) and which can share common data between its documents (share document set info\columns).
Document Set is very useful when it comes to managing the documents for a single project or task. For e.g. a manager while working on a project wants to create a single folder\entity with all the documents related to that project. He also wants that each document shares the project info (for e.g. Project Id, Manager name etc.) and can be checked in\checked out individually. Document Set will also allow him to add a cover letter\welcome page to the entity(or his set of documents) and use some basic document features like record version history, start a workflow, e-mail document set etc.

Q. What are Projected Fields in SPQuery and when would you use that?
Ans. In SharePoint 2010, Referential integrity can now be implemented using Lookup columns. Joins and ProjectedFields properties of SPQuery were introduced to facilitate this. Projected Fields are the fields which you can access when a list is joined by a lookup columns. These are additional columns from a parent lookup column list.

Q. What is WebProvisioned event receiver and when would you use that?
Ans. WebProvisioned event receiver is fired after the site has been created and is fully provisioned(asynchronous). For e.g. if you want to update the site title of logo after its been created or if you want to add a new list\library after the out-of-box site has been created you can use the WebProvisioned event handler.

Q. If you have to add a new Ribbon button to one of the existing tabs how will you identify the location?
Ans. The Its typically Ribbon.Tabs.group.Controls._children.

Q. How does Client object model works ?
Ans. When we use SharePoint client API’s to perform a specific task, the SharePoint Foundation 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).

Q. How many types of Client Object model extension are available in 2010 and when would you use one or the other.
Ans. 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.

Q. What is difference between Load() and LoadQuery() methods ?
Ans. 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 you load using the Load() method are eligible for garbage collection only when the client context variable itself goes out of scope where as, in  these collections go out of scope at the end of  IEnumerable<List>list.

Q. How can you write efficient and better performing client object applications ?
Ans. You can always use Lambda expressions in your queries to return only specific properties that will be used in your block. You 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(), you can also specify the fields to return from each list to optimize the data access.

Q. How do you access ECMAScript object model API’s ?
Ans. 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 you include this file in the APSX page using a ScriptLink control, all other required JS files are loaded automatically. By linking SP.js to your page, the SP namespace gets 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.

Q. What is the purpose of calling clientContext.ExecuteQuery() ?
Ans. ExecuteQuery gives you the option to minimize the number of roundtrips to the server from your client code. All the components loaded into the clientcontext are executed in one go.