Pages

Sunday, April 3, 2011

Plan browser support for Sharepoint Server 2010

Plan browser support (SharePoint Server 2010)

Its werid to see that the 64-bit versions of IE(7, 8 & 9) are not fully supported as their 32-bit counterparts. Your thoughts?

Saturday, April 2, 2011

Using Javascript to access an external list in SharePoint 2010.

In today's post let's take a look at leveraging SharePoint's ECMAScript Client Object Model to access an external list data. In this post we're going to cover:
  • Using javascript and the client object model to build a products search application that returns products from an external list.
  • Host the application in side of a content editor webpart.
Let's begin by taking a look at the Products external list.

Products External List

Figure 1 shows a list of products external list which is view from the AdventureWorks.Products sql table. Using external content types and lists provides you with the capabilities to connect and manipulate data from external systems such as a web service, sql server database or from a .NET assembly. Leveraging SharePoint Designer 2010 or Visual Studio 2010 provides the tools that's need to craete external content types and lists to be consume in SharePoint or in other applications.  For more information about BCS, external content types and lists check out Microsoft Business Connectivity Services. Now that we have a list of products to work with, next we will leverage SharePoint's client object model to extract and display products based on user's search requests.

Figure 1









Leveraging SharePoint's Client Object Model to access external list data.

Figure 2 and 3 shows will show you the end results. Users will type in the first letter or two, click on the search button and the application returns a list of products based on the user's search request.

Figure 2









Figure 3







To begin we need to add a content editor webpart to host the application.. Add the web part to the home page and then we need to edit html source for the web part. Figure 4 shows the location of the edit inside of the ribbon. Inside of the HTML editor copy and paste the javascript source code thats located as a file to download at the end of this blog post.


Figure 4





Notice in the source code the CAML query and the 'Include' statement inside of the clientContext.load method. Both are required to access data from an external list. See Figure 5

Figure 5








Inside of the CAML query the Method tag provides the operation name used to query the Products list.. The Name attribute is where you specify the name of the operation. Note that the value of the Name attribute should be a valid operation that exists in the external content type. See Figure 6 shows you list of operations that the external content type supports.

Figure 6








The ViewFields tag  requires you to include all fields that anoperation returns. Remember confuring your external content type and in the wizard the their step Return Parameters ? In this step you can specify the fields that you want to return for an operation.  Figure 7 shows the button to edit a selected operation and Figure 8 shows the Return Parameter step where you can configure the operation's return fields. Finally in the clientContext.load method the 'Include' statement makes the fields available to use in the onQuerySucceeded function.

Figure 7







Figure 8












Let's recap
  • Using BCS provides you the capabilities to expose external data using external content types and lists.
  • Leveraging the Client Object Model you can access external list data and expose it to the client.
  • The Method tag  specifies the CURD operations to use whne querying an external list. This gives you the ability to implement select, update and delete CAML querites against external lists.
  • Make sure you include all fields that anoperation returns inside of the ViewFields tags. Do the same for the 'Include' statement inside of the clientContext.load method as well.


For a copy of the AdventureWorks database check out this link: Microsoft SQL Server Database Product Samples.


Sample Source Code:

Saturday, March 26, 2011

Cognizant Boosts Efficiency, Cuts Costs, with Collaboration and Development Platform

Hey readers, check out this case study how Congizant, a global provider of IT, consulting and business processing outsourcing, leveraged SharePoint Server 2010  to improve efficiency, cutting cost and bringing collaboration within their company. Just awesome!!!! Let me know your thoughts....

http://www.microsoft.com/casestudies/Case_Study_Detail.aspx?CaseStudyID=4000008719

Friday, March 18, 2011

Passed MCTS 70-667 exam

Passed!!!! 783 score!!!!!

Access denied by Business Data Connectivity - Solution

Just a FYI for folks trying to setup BCS. After setting up your external list, if you navigate to this list in SharePoint you might receive the following error: "Access denied by Business Data Connectivity". If so, then follow the instructions in this link. Also, replicate the same permissions to the "Set Metadata Store Permission" section. Since the metadata store contains all the models, external content types, methods and methods instances you need to set the permissions for your users to interact with metadata components, such as external content types. For more information regarding your permission options in the metadata store, check out Business Connectivity Services security operations (SharePoint Foundation 2010) which provides a set of security related admin  task for your BCS service application.

I hope you learn something, let me know what think.....

Thursday, March 10, 2011

Something I learned about wss and moss for SharePoint 2007

In wss the spell checking feature on a wss list is not avaliabe to users and you don't have the option to activate it on site, site collection nor in ca. In moss there is a feature within ca that you activate or deactivate. Took me about 2 hours to figure this hours, grr.

Well I hope you learn something.

Wednesday, January 12, 2011

Using the ECMAScript Client Object Model to display all sub sites from your top level site in SharePoint Server 2010

Hey readers, I wanted to share with you a solution that I came up with on how to show all sub sites from your top level site using SharePoint's ECMAScript Client Object Model. Let’s get started!!!
 
 First, add a Content Query Web Part to your home page.










Home page view after adding the content query web part.










Next, edit the web part by clicking on the down arrow next to the checkbox and select the ‘Edit Web Part’ menu item.








Now we need to do some HTML editing within the Content Query Web Part. To do this we must double click on the content ‘Click here to add new content’, then select the HTML button towards the far right of the ribbon and select ‘Edit HTML Source’ menu item.










Now you should see the HTML Source dialog window appear. Within this window I want you to add the following code below.











ExecuteOrDelayUntilScriptLoaded method?
This method accepts two parameters, your function name and one of SharePoint's scripting files which is required inorder for you to interact with SharePoint. In my solution, the sp.js file provides you with the ability to retrieve site information, list information, even allows you to perform CURD operations against a single list and more. Before we can do this we first allow the sp.js to load, which is the purpose of the ExecuteOrDelayUntilScriptLoaded method, once the file is loaded then your method is executed. There’s a bunch more scripting files which allows you to interaction with other areas of SharePoint check out ECMAScript Class Library for more information.


ShowAllSubSites first establishes a connection to SharePoint by creating an instance of the SP.ClientContext object, similar to SPContext object. Now that I have a connection establish I can begin with retrieving all my child sites by using the ctx.get_web().get_webs() method. In short, this retrieves all sub sites for the current web application. Finally, we call the executeQueryAsync method which does async request back to SharePoint to retrieve all child sites from your top level site. If the call was successful then the onUpdate method is executed, else the onFail method is executed.

 
 
 


After a successful call, now we need to loop though the this.webSubSites collections object to print all child sites to the screen.






Here is your end result:






So here's a simple way to retreive all subsites using the ECMAScript client object model provided to you by SharePoint. You could  a data view web part or a content query web part, but then you're working with xslt and I haven't master xslt.....yet!! Well I hope you’ve learned something from this post, let me know if you like it or not. Other than that, thanks for stopping by. Below is a list of articles that I used to achieve this solution.
References: