Monday, May 10, 2010

Imtech Content Query Web Part Paging - on bottom right side.

How to display Paging Control in Imtech CQWP - Display on the bottom right side?

I wanted to implement paging on a Content Query Web Part. I came across Imtech Content Query Web Part which provides paging functionality. The issue with this web part is that it shows paging control at the top left corner and the docs are displayed below. My requirement was to display paging control on the bottom right side and docs should be displayed above the paging control.
In order to achieve this, I had to customize style sheets provided by Imtech CQWP web part.

1. Open SharePoint Designer 2010, then click on All Files --> Style Library -->XSL Style Sheets
2. Open the ImtechItemStyle.xsl file and select the code highlighted in the below image and cut (CTRL X) it.

3. Open the ImtechContentQueryMain.xsl file and paste the code before end of ForEach loop as shown in the image below.

4. Save both the files ImtechContentQueryMain.xsl and ImtechItemStyle.xsl. Add Imtech Content Query Web Part on the page. Point these style sheets in the web part properties. You will see the paging control on the bottom right corner of the control.

Thursday, May 6, 2010

Secure Store Application ID in SharePoint 2010

Secure Store Application ID

Each Secure Store Service entry contains an application ID that is used to retrieve a set of credentials from the secure store database. Each application ID can have permissions applied so that only specific users or groups can access the credentials that are stored for the application ID. Applications use application IDs to retrieve credentials from the secure store database on behalf of a user. The application can then use the retrieved credentials to access a data source.

I will walk you through - how to create Secure Store Application ID that you can use in External Content Type.

a) Go to SharePoint Central Admin then Manage Service Applications.
b) Click on Secure Store Service Application. If Secure Store Service is not setup, then you have to create one. Look at my article How to Create Secure Store Service.

c) Click on 'Generate New Key' on the ribbon.

d) Enter pass phrase as you like.

e) Now we will have to create Secure Store Application that would help in impersonation. Click New on the ribbon.

f) Enter the required values for the target application settings. Click Next.

f) You can add more fields if you like, for now use the default Windows Username and Windows Password. Click Next.

g) Specify Administrator for the target application. You can specify Members for the target application as well if you like to. Click Ok.

h) Now your Target Application has been created successfully.

i) Now tick the check box beside the Target Application then click on Set Credentials on the ribbon to set the credentials for impersonation.

j) Enter a credential owner, the windows username and windows password that will be used for impersonation by this target application then click Ok.

Now Application ID has been created we can use this target application for impersonation to access BCS External list.


Wednesday, May 5, 2010

Business Connectivity Service - External List in SharePoint 2010

Business Connectivity Services Overview:

Microsoft SharePoint Server 2010 and the Microsoft Office 2010 suites include Microsoft Business Connectivity Services, which are a set of services and features that provide a way to connect SharePoint solutions to sources of external data and to define external content types that are based on that external data. A Technet article describes in details about BCS BCS Overview - Technet

Here I am gonna talk about how to create a SharePoint external list and then modify the data that would reflect the changes in the external source as well.
Inorder to make BCS External List working, you have to setup these 2 services.

BDC Service and Secure Store Service.
Read my articles about how to setup these services

1) BDC Service

2) Secure Store Service

After setting up these services successfully we have to create external content type.
An External Content Type is an xml file that defines an object that can be used in business application. The definition could be:
* The fields of data that are contained in the object
* The methods to create, read, update, query, or delete that object
* Actions that users can take on the object
* Information that supports connecting to the external data source that provides the object’s data

Create External Content Type

a) Open SharePoint Designer 2010(SPD)
b) Open the site
c) Click on External Content Type at left panel.

d) On the ribbon top left corner click on 'External Content Type'
e) A page will be opened where you can define the name, description, data source etc.

f) Click on "click here to discover external data sources and define operations"
g) Operation Designer will be opened. Click on Add Connection to create a connection with your external data source.

h) Select 'SQL Server' as data source type

i) A new popup will be opened where you define the SQL Server Connection details.

j) On the radio buttons select 'Connect With Impersonated Windows Identity' and provide the Secure Store Application ID. (You can read up my article what is Secure Store Application)
Note: If your external list does not work with 'Connect With Impersonated Windows Identity' then try using 'Connect With Impersonated Custom Identity'. Windows Identity worked with me.
k) Now External Content Type has been setup succesffully, lets go and create External List where we can pull the data through this connection and manipulate with the data.

Note: Try creating External Content Type on the local system where SharePoint 2010 is installed. First I tried to create ECT using remote machine, it kept asking me credentials and did not let me create the Connection to external data source.

Create External List

a) Go to your sharepoint site.
b) Click Site Actions --> View All Site Content
c) Click on Create
d) Select External List then create

e) A page will be opened; define the name of the External List and at the bottom, click on
External Content Type Picker. It will open up a popup where you can see the content type you created in the previous steps. Select the Content Type, click OK

f) Click on Create button. Your External List will be created and the data will be displayed.

h) Select check box on any row - I chose second row then click on Edit Item on the ribbon.
i) Modify data in the fields then hit Save. In my case I have fields called LastName, FirstName. I have changed the values as Lawrence, Smith

j) Screen will refresh and as you can see data has been saved in the list.
k) Now lets verify if the changes have really been reflected in the external system or not.
l) You can see in the second row, data has been modified in SQL Server table under columns LastName and FirstName.

I hope this has been informative for you.