Posts Tagged 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
InfoPath cannot grant access to these files and settings because the form template is not fully trusted. For a form to run with full trust, it must be installed or digitally signed with a certificate – InfoPath 2007 forms Security Levels
Posted by Rajanihanth in .Net, Active Directory, DirectoryServices, InfoPath 2007, InfoPath 2010 on July 18, 2012
After giving the Full Trust to the Form template (See here), we will be able to preview the InfoPath form and get information from other domains, or access files and settings on a user’s computer. But when we publish InfoPath form on SharePoint and try to access the from then you will be getting this error. 😦
Error:
Details:
Text format of the error:
Form template: file:///C:\Documents%20and%20Settings\RajanihanthV\Desktop\XmlProc\InfoPath\ADInfo.xsn</pre> The form template is trying to access files and settings on your computer. InfoPath cannot grant access to these files and settings because the form template is not fully trusted. For a form to run with full trust, it must be installed or digitally signed with a certificate.
If we need to access the form from SharePoint, we need to be digitally signed the form even it is fully trusted. This is pretty simple, but we have to do this process after publishing the form on SharePoint only. Here are the steps.
Step 1: Navigate to the Document (form) Library, where your form published
Step 2: Click Settings on the Document Library Settings
Step 3: Advanced Settings
Step 4: Edit Template
Step 5: Click the Form Options on the Tools menu
Step 6: Click Sign this Form Template and create or select certificate, then OK
That’s all. You can try and see. 🙂
This will work only for you (author), If you want give access to all users you have to get the digital signature from 3rd party vendors and signed the form.
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:
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/
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:
Developing a simple web part (.wsp) using WSPBuilder
Posted by Rajanihanth in SharePoint 2007, Webpart, WSP Builder on May 28, 2012
Before we started the development, we have to install the WSPBuilder (SharePoint WSP tool), an extensions for Visual Studio. Just download the latest version here and install it. It is pretty easy steps.
Step 1: Create a new project on visual studio and then select the project type WSPBuilder under C# programming language (I am using Visual Studio 2008).
Step 2: This is will create the following structure in the solution explorer.
Step 3: Right click on the project (WSPBuilderStepBiStep) and then add a new Item.
Step 4: This will give the following dialog box and then select WSPbuilder and Web Part Feature template. Enter the name and click Add button (I have given WebPartStepBiStep here)
Step 5: We will get the following dialog box and asking for the scope for this Web Part. I just modified the description and select the scope and then click OK.
Step 6: The solution explorer will look like this. Under the 12 hive folder you can see the Template and Features sub folders.
Step 7: Double click on the WebPartStepBiStep.cs file and add your custom code on the right place. I just modifed the property like this:
public string MyProperty { get { if (_myProperty == null) { _myProperty = "Hello Step Bi Step!"; } return _myProperty; } set { _myProperty = value; } }
If you wanna to add a label rather than using this LiteralControl just replace the following code
this.Controls.Add(new LiteralControl(this.MyProperty));
with this
System.Web.UI.WebControls.Label label=new System.Web.UI.WebControls.Label(); label.Text = "Hello StepBiStep!"; this.Controls.Add(label);
Step 8: After replacing the code, the CreateChildControls() method will look like this:
protected override void CreateChildControls() { if (!_error) { try { base.CreateChildControls(); // Your code here... System.Web.UI.WebControls.Label label=new System.Web.UI.WebControls.Label(); label.Text = "Hello StepBiStep!"; this.Controls.Add(label); } catch (Exception ex) { HandleException(ex); } } }
Step 9: To build the project, just right click on the project name (WSPBuilderStepBiStep –> Build) and click Build.
Step 10: To build the WSP, Right click on the project name(WSPBuilderStepBiStep) –> WSPBuilder –> Build WSP
Step 11: This will create the .dll and .wsp files.
Step 12: To deploy the web part (.wsp file), right click on the project name(WSPBuilderStepBiStep) –> WSPBuilder –> Deploy
Step 13: You will get the following output, saying the .wsp file deployed successfully (done!).
Step 14: Go to the Web Part gallery and populate the deployed Web Part on the New web part page.
Step 15: To use this Web Part in to your page, just follow these steps from my previous post. That’s all! Happy WSPBuilding..! 🙂
Please note: You have to run the Visual Studio as Administrator, otherwise you will get this error when you deploy the web part.
References:
1. http://rasor.wordpress.com/2008/10/12/wss-dev-quickstart/
How to add a custom web part to SharePoint 2007
Posted by Rajanihanth in SharePoint 2007, STSADM, Webpart, WSP Builder on May 25, 2012
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.
Reference:
http://support.microsoft.com/kb/939306