Saturday, October 6, 2012

Custom Action with Custom Code

Here is a great example of Custom Action with custom code. You can link your custom action button (ECB menu item) with your custom code.

http://www.thorntontechnical.com/tech/sharepoint/sharepoint-2010-context-menu-item-with-custom-code#.UG_K1k3Miz4

Tuesday, October 2, 2012

SharePoint Interview Questions and Answers


How does Client object model works

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

Q. What Do you know about SharePoint Object Model?
Ans. In Sharepoint Object model there are two Important namespaces, Microsoft.Office.Server and Microsoft.SharePoint . The Microsoft.Office.Server namespace is the root namespace of all Office Server objects and Microsoft.SharePoint is the root namespace for all WSS objects.

Q. How Do you use\refer External Javascript and Css file in your WebPart?
Ans. You can use javascript,Css or Image files placed in _Layouts or any other location by registering them on the webpart page.

Q. How Do you bind a Drop-Down Listbox with a Column in SharePoint List ?
Ans.
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.

Q. What are the various tools used for creating the solutions?

Ans. Some of the common tools are

1. WsPBuilder

2. VSeWSS (Visual Studio extensions for WSS )

3. Stsdev

Q. Client Object Model vs Server Object Model in SharePoint 2010 ?
Ans. using Client Object Model we can access the data from the system where sharepoint server is not installed on the machine via Web Services , API , JavaScript etc

Where as In Server Object Model is like a Production Server Environment to access the data where SharePoint server installed on the machine .

Monday, October 1, 2012

SharePoint 2010 101 Code Samples


SharePoint 2010 Code Samples for Beginners. 

Each code sample is part of the SharePoint 2010 101 code samples project. These samples are provided so that you can incorporate them directly in your code. Each code sample consists of a standalone project created in Microsoft Visual Studio 2010