Archive for category SharePoint 2007
Creating Business Data Catalog(BDC) using Application Definition File(ADF) – SharePoint 2007
Posted by Rajanihanth in BDC, SharePoint 2007 on September 12, 2012
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
Keep other values in their default, and then click Import.
You will be getting this success message!
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..!!
References:
http://msdn.microsoft.com/en-us/library/ms563661(v=office.12).aspx
http://msdn.microsoft.com/en-us/library/bb410048(v=office.12).aspx
Create an Application Definition File (ADF) using Application Definition Designer (ADD)
Posted by Rajanihanth in BDC, SharePoint 2007 on September 9, 2012
What is ADF?
This is an XML file that describes your data source, how to connect to it, and the various queries, actions, and filters to display and sort the data. There are many way to create this ADF such as Application Definition Designer (ADD) and BDCMetaMan, I am going to use ADD to create the ADF.
Okay, we will see the steps here:
1. Installing and configuring the “Application Definition Designer” tool.
Please follow the steps in my previous post.
2. Creating the ADF using Application Definition Designer
Step 1: Open the ADD start –> programs –> Application Definition Designer
Step 2: You will be getting the designer and click on “Add LOB System”
Step 3: Then click on Connect to Database, you will be getting this dialog box to select the DB connection
Step 4: Choose connection type and enter connection string (I have created a database sample for this, you can see here)
Connection Type: SQL Server Connection String: “Data Source=<ServerName>;Initial Catalog=Database1;Integrated Security=True”
Step 5: Click Connect button and you will be getting this window
Step 6: Click Add table tab and drag & drop the Database1.dbo.Table1 on the Design Surface
Step 7: Click Ok and then you will prompt to get the name of LOB, enter the name and click OK (I have given ADF_Table1)
Step 8: You will get the screen like this
Please note: We need to do few modifications to complete this task, otherwise we will be getting the following error when we use this ADF on the SharePoint1 😦
“There are no Business Data Types loaded in the Catalog – Business Data Type Picker”
I have a post about this error in my previous article, please check it out.
Step 9: So Expand “FindAll_[Database1].[dbo].[Table1]” node under Methods and click Instances
In the Instances node click “FindAll_[Database1].[dbo].[Table1]_Instance” and you can see the properties of this method.
You can see the “MethodInstanceType” property has “IdEnumerator” method instead of the “Finder”. So just click the drop down list and select the Finder method.
Step 10: That’s all we done with the ADF now, just click the export button and get the file
You can see the ADF (xml) file now 🙂
Thanks R./
How to get the list of folders and subfolders from a SharePoint document library
Posted by Rajanihanth in SharePoint 2007, SharePoint 2010, Tech Tips-SharePoint on July 13, 2012
There are many ways to get files & folder details from SharePoint (programmatically) but my manager asked me to provide the list of folders and sub folders from a SharePoint document library urgently. So I wanted get an idea to provide the information quickly, after spending few minutes on the web and found this post (I know about the DIR command but didn’t think about the SharePoint UNC). Yes, we can get the details using DOS command with UNC path. 🙂
First of all, we want to know about UNC and the DIR command.
UNC: Universal Naming Convention, a format for specifying the location of resources on a local-area network (LAN). Read more about this here.
Syntax: \\<servername>\<sharename>\<directory>
DIR: Display a list of files and subfolders. Read more about this here.
Syntax: DIR [pathname(s)] [display_format] [file_attributes] [sorted] [time] [options]
To get SharePoint UNC path, just remove http: from the SharePoint url and replace the forward slash with backslash. So my document library path is:
http://ServerName/doccenter/Administration/StepBiStep
then it’s UNC will be like this:
\\ServerName\doccenter\Administration\StepBiStep
Okay.. we will see the steps here, I have created a document library (StepBiStep) for testing purpose.
Step 1: Open the cmd prompt
Step 2: type the following statement in the command-line and press Enter key.
DIR /B /A:D / S [UNC Path] > [File Name]
– /B -Bare format (no heading, file sizes or summary)
– /A:D -Folder file attributes
– /S -Include all subfolders
– [UNC Path] -The path, which you want to get all the folders and subfolders
– [File Name] -A text file name to store the folder details
So our command is looks like this, I have used a text file (FolderLists.txt, which is located in C: drive) to store the details.
DIR /b /A:D /S \\ServerName\doccenter\Administration\StepBiStep > c:\FolderLists.txt
Step 3: It will take few minutes to generate the list. You can open in a Notepad and see..!.
That’s all guys, enjoy! I do welcome your comments. Please leave them here! 🙂
References:
Access is denied: ‘xxx.dll’ – Manually add an assembly (.dll) to the GAC on Windows Server 2008 R2
Posted by Rajanihanth in .Net, GAC, SharePoint 2007, SharePoint 2010, Webpart on June 26, 2012
I supposed to post this issue few months ago, but I don’t really know why this has been in my draft folder till this date! When we were migrating our servers to new environment, we deployed some custom web parts manually. While deploying the web part (Drag and drop the assembly (web part .dll) into Global Assembly Cache (GAC) folder) I have got the following wired error message! 😦
GAC normally located in C:\Windows\assembly directory, and ‘WebPartStepBiStep.dll‘ is my web part assembly.
After spending some time on the web, I have got the solution here. Actually the ‘User Account Control: run all administrators in Admin Approval Mode’ was Enabled on the Local Security Policy. Which means the local administrators group required Admin Approval Mode (AAM) to perform these kind of operations. Here is the definition for Admin Approval Mode (AAM) from MicroSoft site.
Admin Approval Mode: AAM is a User Account Control (UAC) configuration in which a split user access token is created for an administrator. When an administrator logs on to a Windows Server 2008, the administrator is assigned two separate access tokens. Without AAM, an administrator account receives only one access token, which grants that administrator access to all Windows resources.
To access the Local Security Policy, either we can goto the Administrative Tools –> Local Security Policy OR we can run the ‘secpol.msc’ on the command prompt.
Start –> Administrative Tools –> Local Security Policy
Click Start –> Cmd –> type ‘secpol.msc’ then enter
You will be getting the Local Security Policy window like below and the highlighted is the AAM.
So the solution for our problem is Disabled the User Account Control. To do this double click on the highlighted policy on the Local Security Policy above and then you will be getting this window.
Click Disabled and OK.
After disabling this you will be able to drag and drop the .dll to the GAC.
Please Note: 1. Rebooted required for changes to the local security policy on the server.
2. Disabling this can make security problems in your environment, so after completing task, you should be enabled back the UAC.
That’s all guys, Happy drag and dropping..!
Thanks. R/.
References:
Content Editor Web Part (CEWP) & JavaScript duplicating entries in SharePoint 2010
Posted by Rajanihanth in SharePoint 2007, SharePoint 2010, Webpart on June 19, 2012
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! 😦
Here is the weather forecast web part in the 2007 which has JavaScript to update the weather from their web site.
The JavaScript code in the Source editor:
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!
After spending few minutes I have found the solution in this post, actually SharePoint 2010 does not support the JavaScript directly into the source editor. So we cannot copy and paste the JavaScript to the CEWP editor instead, we have to create the scripts as a txt file (paste into a Notepad and save), upload into the SharePoint and then pointing that file as the source of CEWP.
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..!
Thanks. R./
References:
1. http://sharepointadam.com/2010/08/31/insert-javascript-into-a-content-editor-web-part-cewp/
Unexpected Error has occurred. Error is ‘SetParent failed for Database ‘AR633564737049916886′.’
Posted by Rajanihanth in BDC, SharePoint 2007 on June 14, 2012
When I was installing the Application Definition Designer, I have got the following wired error message! 😦
The text format of this error message is:
Unexpected Error has occurred. Error is 'SetParent failed for Database 'AR633564737049916886'.' --> SetParent failed for Database '<em>AR633564737049916886'.' --> Failed to connect to server. \BDC. --> An error has occurred while establishing a connection to the server. When connecting to SQL Server..
This is not even a brief message to understand no? After spending few minutes, I have found the possible causes for this error.
1. Not enough permissions to configure BDC (Business Data Catalog) instance
2. There is no BDC instance on our SQL Server, this means the installation expects the BDC instance to continue.
In my case, I have adequate permissions for BDC, so the problem is 2nd one. If we run the BDCStudioSetup.msi file directly, Instead of running the setup.exe on the “BDC Definition Editor” directory then we get this error! 😦
You can see the complete installation and configuration of Application Definition Designer here.
Happy configuring..! Thanks. R./
References:
1. http://www.techyv.com/questions/setparent-failed-database-error-while-installing-data-catalog
2. http://www.microsoft.com/en-us/download/details.aspx?id=79
Installing and configuring the “Application Definition Designer” tool – BDC
Posted by Rajanihanth in BDC, SharePoint 2007 on June 14, 2012
Everyone knows about the usage of Application Definition Designer, this is a Microsoft tool that comes with the SharePoint Server SDK. You can see the overview and the system requirements here. While installing this tool I have faced few problems, so I just wanted to keep the steps in my bolg.
Step 1: Download the tool and double click the “OfficeServerSDK.exe”, You will be getting this screen.
Step 2: Click Next 😦
Step 3: The Office SharePoint Server 2007 SDK has been successfully installed. Great!
Step 4: Navigate to SDK installation path\Tools\BDC Definition Editor\. The default installation path for the MOSS SDK is <%Program Files%>\2007 Office System Developer Resources\. For me this is the path..
C:\Program Files \2007 Office System Developer Resources\Tools\BDC Definition Editor
Step 5: In this directory, double click the setup.exe
Please Note: If you double click the BDCStudioSetup.msi file directly, Instead of clicking setup.exe then you will get this error. This happened to me when I installed! 🙂
Step 6: Click Accept and continue, this will configure the SQL client.
Step 7: Click Next and close! 🙂
Step 8: That’s all, you can run the “ApplicationDefinitionDesigner.exe” in the “All Programs”
Step 9: We are ready to create the ADF (Application Definition File) to configure the BDC (Business Data Catalog) now.
Thanks. R./
References:
1. http://www.microsoft.com/en-us/download/details.aspx?id=79
2. http://nareshbojja.wordpress.com/2008/09/08/setparent-failed-for-database/
There are no Business Data Types loaded in the Catalog – Business Data Type Picker
Posted by Rajanihanth in BDC, SharePoint 2007, Webpart on June 7, 2012
I was working on BDC (Business Data Catalog), to display the user profile data from SQL Server in SharePoint 2007. I was using “Application Definition Designer” (A Microsoft tool that comes with the SharePoint Server SDK, you can see the installation and configuration here) to generate the ADF (Application Definition File). I tried to access the Business Data Types on the SharePoint page and then I have got the following wired error message. 🙂
BDC is not a really new stuff, so I tried to find the solution on the web but I didn’t get any direct solution immediately. Most of them are suggested to check the permission but I have adequate permission for BDC. Finally I have got the solution form this thread. Actually this is a bug in the Application Definition Designer and I don’t really know why it’s still there!
There might be two reasons to getting this error.
1. Not having enough permission to access the BDC
2. The “Finder” method is not generating properly in the “MethodInstanceType” property.
In my case I had adequate permisioion for the BDC, so the “Finder” method was my problem.
You can see the “MethodInstanceType” property has “IdEnumerator” method instead of the “Finder”. So just click the drop down list and select the Finder method.
Then just export the ADF again, the Business Data Type Picker is showing the entries now huh? 🙂
References:
Deploy and Re-deploy a web part solution package (.wsp) using STSADM command.
Posted by Rajanihanth in SharePoint 2007, STSADM, Webpart, WSP Builder on June 4, 2012
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.
Deploy :
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.
Re-Deploy:
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..! 🙂