Posts Tagged Web Part
Accessing the data from the database Or some other external data source and display on a SharePoint site is not a big deal these days. As developers we can create a web part and deploy it on the SharePoint but without writing any code, how we can display? BDC is the way to do so…!
Business Data Catalog
I am going to use very basic steps to create the BDC on my SharePoint 2007. If you want to create from the scratch without using any tools such as Application Definition Designer then you can follow this post.
These are the simple 4 steps I am going to use:
- Create a table and insert some values in SQL Server database
- Create an ADF using Application Definition Designer
- Import the ADF file into the Shared Service Provider(SSP)
- Configure the BDC on SharePoint
CREATE A TABLE AND INSERT SOME VALUES IN SQL SERVER DATABASE
You can see this post to create a sample database and we will retrieve this data using BDC. I have named Database1 and Table1
CREATE AN APPLICATION DEFINITION FILE (ADF) USING APPLICATION DEFINITION DESIGNER (ADD)
You can see this post to create an ADF sample and the file name is ADF_Table1
IMPORT THE ADF FILE INTO THE SHARED SERVICE PROVIDER (SSP)
Go to Central Administration (CA) and click your shared service provider (SSP) (Mine is SharedServices2)
Click Import application definition in the Business Data Catalog section
Click Browse, and select the ADF which we have created in the previous step
Click OK to finish the process!
If you want to manage the security just click the manage permissions and do so, that’s all we are done with the step 3! 🙂
CONFIGURE THE BDC ON SHAREPOINT
The last step is to use the Business Data List Web Part to show our data, go to any site and add a Business Data List Web Part to the page.
Open the tool pane
In the Business Data List task pane, click the browse button
The following Business Data Type Picker popup window will appear, you could see our Application Data File, Select the ADF_Table1_Instance
Click OK and publish the page, you can see the data on the web part!
That’s all guys! Happy BDC ing, we will see next BCS on SharePoint 2010! Ensoy..!!
Recently we have migrated our SharePoint 2007 application to SharePoint 2010 and we also had manually configured few web parts in the new environment. Most of the web parts were working perfectly like sharepoint 2007 but one content editor web part which shows the weather forecast had some wired repeating behavior! 😦
I have created the CEWP in 2010 and paste the source code in to the editor.
and Publish the page, It is working fine no? but not really..!
Whenever I edit the page, the web part is duplicating the weather widget like this!
Step 1: Open a Notepad and paste the source code
Step 2: Upload the txt file into SharePoint
Step 3: Get the url path of the txt file and paste it on the content link property of the content editor pane on the right side and click ok.
That’s all. No duplication probs any more. Happy Migrating..!
Deploying a web part solution to the SharePoint using STSADM is an easy task, everyone knows about it. But while developing a web part, sometimes we need to re-deploy the solution again and again. In this case we cannot simply re-deploy the solutions and we have to follow some additional steps to redeploy again.
There are several ways to create the solution file, but I have used the WSPBuilder to create this web part solution. You can see this in my previous post.
There are 2 steps to deploy a solution using stsadm.
- Add solution – Add a solution file to the solution store. See more details here.
- Syntax: stsadm -o addsolution -filename <solution file name>
- Deploy solution – Deploys files related to a solution from the configuration database to individual front-end Web servers in the farm. See more details here.
- Syntax: stsadm -o deploysolution -name <solution name> -immediate -allowgacdeployment -force –allcontenturls
- We need one more command to Executes all administrative timer jobs immediately instead of waiting for the timer job to run. See more details here.
- Syntax:stsadm -o execadmsvcjobs
Ok, we will see the steps here:
Step 1: Open the cmd prompt and change the directory (cd) to stsadm.exe location, I am using SharePoint 2007 so this is the path: “cd c:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\bin”
Step 2: Adding the solution, my solution file is in the C:\Temp\
stsadm -o addsolution -filename C:\Temp\WSPBuilderStepBiStep.wsp
Step 3: Deploying the solution
stsadm -o deploysolution -name WSPBuilderStepBiStep.wsp -immediate -allowGacDeployment -force -allcontenturls
Step 4: Executing the timer jobs
stsadm -o execadmsvcjobs
Please note: The name and filename in the above commands, if it is filename we have to use full file path.
When we deploy the solution package without retract and delete then we will get the following error message:
There are many ways to do this (Using UI, WSPBuilder and so…) but here are the steps which I normally used (Specially in the production servers):
- Retract solution: Retracts the specified solution’s deployment which removes files from the front-end Web server. This is actually reversing the deployment. See more details here.
- Syntax: stsadm -o retractsolution -name <solution name> [-immediate] [-allcontenturls]
- Delete solution:Removes a solution file (package) from the solution store. See more details here.
- Syntax: stsadm -o deletesolution -name <name> [-override]
Here are the steps:
Step 1: Retracting the solution
stsadm -o retractsolution -name WSPBuilderStepBiStep.wsp -immediate –allcontenturls
Step 2: Executing the timer jobs
stsadm -o execadmsvcjobs
Step 3: Deleting the solution
stsadm -o deletesolution -name WSPBuilderStepBiStep.wsp –override
Step 4: Re-deploy the solution again, for this follow the steps 1 to 3 in the Deploy!
That’s all, Happy deploying..! 🙂
Everyone knows about this, but I wanted to re-use this for my next series of custom web part posts. 🙂
I have already developed and deployed the web part (WebpartStepBiStep.wsp) using STSADM command, you can see my previous post here. Now we will see the steps:
Step 1: On the SharePoint site, click Site Actions –> Site Settings –>Modify all site settings
Step 2: Site Settings page, click Web Parts under Galleries
Step 3: On the Web Part Gallery page, click New
Step 4:On the New Web Parts page, select the check box next to the Web Part that you want to add, and then click Populate Gallery
Step 5: Web part will be showing on the web part gallery.
Step 6: Click Site Actions, and then click Edit Page
Step 7: Click Add a Web Part
Step 8: In the Add Web Parts dialog box, select the check box next to the Web Part that you want to add, and then click Add button
Step 9: The web part will be shown on your page.
Step 10: If you want modify the appearance and layout then Click Publish.
Step 11: That’s all, we are done.