Archive

Archive for the ‘sharepoint’ Category

Sharepoint Rich Text box in Webparts

November 6th, 2007 Anuraj P 2 comments

In my current project, I have to develop a webpart, in which users should able to Add / enter comments using Sharepoint native rich text box. I have tried, RichTextField, I am able to add it, but while rendering it is giving a lot of problems like, Control mode not set etc.

After some “google”ing I found some other control, the InputFormTextBox, using this, I am able to create a webpart, which uses sharepoint default Rich Text Editor.


InputFormTextBox txt = new InputFormTextBox();
txt.TextMode = TextBoxMode.MultiLine;
txt.RichText = true;
txt.RichTextMode = SPRichTextMode.Compatible;

And you can use txt.Text property to read the contents of the Textbox. I am adding / inserting the Text to a multiline column in a custom list.

Categories: .Net, sharepoint Tags:

Adding items to sharepoint list

November 5th, 2007 Anuraj P No comments

Sometimes it is required to manage sharepoint lists using C# or webparts. The project, currently I am working requires the same. Add method is available for list(SPList), but there is no way how can I update or save it. After little “google”ing I found it.

SPListItem MyItem = currentList.Items.Add();
MyItem["myfield"] = "Hello World";
MyItem.Update();

Thats it, it will update myfield column with “Hello World”.

Categories: .Net, sharepoint Tags:

Code review

November 1st, 2007 Anuraj P No comments

Last few days I was to code review one of our sharepoint projects. Actually there is nothing for review because almost all the pages are developed by MS Developers and only we are customizing it. But I have to do the job and it give me some good experiences.

Lessons learned from Code review.

  1. Always dispose objects, when you are not using it.
  2. Use string.Compare instead of using ToUpper() and “==” combination for string evaluation
  3. Avoid direct casting, instead of use “as” operator
  4. Try to use “using” code block, if the class implements “IDisposible” interface
  5. Always close Database connections, before disposing it.

Here is the few things I learned in the code review session.

Categories: .Net, sharepoint Tags:

The search request was unable to connect to the Search Service

October 25th, 2007 Anuraj P 4 comments

The WSS project I was working, we have to implement a search mechanism, it should search all the stuff. But the problem, I didn’t see the sharepoint search, and how the results will getting display? While clicking on the search button it will throws an error like “The search request was unable to connect to the Search Service”. I have tried lot of things like changing the Search service running permissions, etc. But nothing happend. And from one MSDN blog I got that I have to start the Indexing service, which is disabled by default. I have logged as Administartor and started the Indexing service from Administrative Tools > Services. Then Indexing Service. Changed the properties, disabled to manual. And started the service. Then I resets the IIS. Clicked Search, in the WSS screen

volia ! it is giving some results.

Update: How to install the Indexing service : Goto Control Panel > Add / Remove Programs > Add / Remove Windows Components > Select Indexing service, if not selected, Click Next, it will ask for Windows XP Service Pack 2 CD(If you are using Windows XP SP2). Then select the location, click ok, Windows will start installing the service. After installing, restart the system, Go to Services from Control Panel > Administrative Tools > Services Or Select Run > Type “Services.msc”, select Indexing service, right click and choose the option start

Categories: sharepoint Tags:

Error : WPSC is undefined

October 24th, 2007 Anuraj P No comments

While playing with custom master page file in WSS 3.0, suddenly my Picture Library’s was stopped working.  Getting some javascript error like “WPSC is undefined”. I am getting this error only in the picture librarys.

Suddenly I found I have removed on line from the default.master page while copy / paste.

<SharePoint:ScriptLink language=”javascript” name=”core.js” Defer=”true” runat=”server”/>

Now it is works fine.

Categories: .Net, Javascript, sharepoint Tags:

Updating webparts

October 22nd, 2007 Anuraj P 2 comments

When working in a sharepoint project I have to create some webparts. Initially it was for the port 80 application, and was going fine, but when we created a new application in a different port, thing gone crazy. I have developed the web parts using VS Webpart template, clicking deploy webpart menu, only deploys the webpart on port 80 application. I have tried to modify the setup.bat and changed the url http://localhost to http://localhost:9090 but it is also not helped.

After some time, I un-installed the webprt assembly from GAC, re-installed the same with gacutil -i command. Then resets the IIS using “iisreset” command.

Now it is working fine.

Categories: .Net, sharepoint Tags: