Monday, June 30, 2008

Add Custom Words in Sharepoint Spell Checker

Imagine you can't find any way to add your custom words to put on ignore list during your spell checking. Its frustrating isn't it. But as i can see Microsoft is always particular in hiding their way of coding and left us developers to explore the unimaginable capabilities of Object Model.

Today after a struggle for 15 mins, i found the solution to add up your own custom dictionary words in sharepoint. No worries now u can tell spell checker to ignore your love words.

Oh ok Back to the point.
1) Create a document library in your root site of your publishing folder ( this is where you will get your spelling feature), and give the name of the library as "Spelling".
2) Then upload a text file named “Custom Dictionary.txt”. Put your magic dictionary words separated by a single line. That is each words in each line.

There you go, do a IISRESET you are done..

DO post your comments if you find this helpful.

Add SharePoint List Items with InfoPath

Today i was out of work and got bored. So i want to explore something new, and among the list of my final frontiers is the Infopath Forms with Sharepoint.

So i tried many options with Infopath forms and yet amazed with its cool capabilities of quick form creation with all the form validation and also your custom Javascript code to actually submitting a form with MsXML xmlhttp request. Cool.

Ok now here is a good article written by Matt how to create a form to insert or update a sharepoint list item using its Lists.asmx webservice.
And its easy to display to show the details of your list also, its like ur OLD buggy SPD.


http://www.infopathdev.com/blogs/matt/archive/2006/02/02/Add-SharePoint-List-Items-with-InfoPath.aspx

Friday, June 27, 2008

New Buzz

Sharepoint and Iphone compatibility is discussed in details in this link
http://www.networkworld.com/community/node/29262?hpg1=bn

Sharepoint DataFormWebPart as Dropdownlist

This requirement is funny as we want to build a custom form which is easily maintainable and which is flexible for future changes.
Current client has no resources to maintain the webparts or build a new one so he is totally dependant of The (Gruesome) Buggiest SOftware in the market.
Ladies and gentleman may i present MOSS Designer.

Now how do i build dropdown which values has to be populated form a list located in different site and that too has to be filtered according to the paramater passed as selectedvalue of another dropdownlist as postback.

Simple ... The only powerful control in sharepoint designer is DataFormWebpart. Man you can design , capture , gather any information from any sitecollection located in the portal with this webpart, that too without writing a code.

So i used it to add the iterate the records and populate to my dropdown with the help of a powerful version on spdatasource . No wonder you have to work on the formating inside the XSL tags.

My Fav Channel IBN live

Thursday, June 26, 2008

Budweiser Brewery Tour




Sharepoint Custom DateTimeField control

I don't know if anyone has worked on the DateTimeField sharepoint control to display the value associated with it.

I searched a lot in blogs and google for this BUG from Microsoft till 07 Apr 2008 because thats when i have to write my own custom control. You can't use the datetimefield in SPControlMode.Display.

Here it goes:


public class myDateTime : DateTimeField
{
protected override void RenderFieldForDisplay(HtmlTextWriter output)
{
if (base.ControlMode == SPControlMode.Display)
{
if (base.ItemFieldValue != null)
output.Write(((DateTime)base.ItemFieldValue).ToShortDateString());
}
else
{
base.RenderFieldForDisplay(output);
}
}
}

Hey do post some comment if it helps you anyway !!

Sharepoint Lookup Field values

Oh I hope this post will be interesting for most of the users who wants to develop their own webparts.

Lets consider you require to display the values of lookup field for your webpart form in a dropdown.

You can use it in your dropdown datasource:
where field is SPField and list is SPList

DropDownList ddl = new DropDownList();
ddl.ID = field.Id;
ddl.DataSource = DataSource(field, list);

Here it goes :


public ICollection DataSource(SPField Colfield, SPList lookupList)
{
string lookupField;
int num = 0;
SPFieldLookup lookup = (SPFieldLookup)Colfield;
lookupList = lookupList.ParentWeb.Lists[new Guid(lookup.LookupList)];
if (lookup != null)
{
lookupField = lookup.LookupField;
if (string.IsNullOrEmpty(lookupField))
{
lookupField = "Title";
}
}
else
{
return null;
}
DataTable table = new DataTable();
table.Columns.Add(new DataColumn("ValueField", typeof(int)));
table.Columns.Add(new DataColumn("TextField", typeof(string)));
if (!lookup.Required && !lookup.AllowMultipleValues)
{
DataRow row = table.NewRow();
row[0] = 0;
row[1] = SPResource.GetString("LookupFieldNoneOption", new object[0]);
table.Rows.Add(row);
num++;
}
if (lookupList != null)
{
try
{
SPField field = lookupList.Fields.GetField(lookupField);
SPQuery query = new SPQuery();
StringBuilder builder = new StringBuilder("builder.Append(lookupField);
builder.Append("\"/>
builder.Append(lookupField);
builder.Append("\"/>
");
query.ViewXml = builder.ToString();
SPListItemCollection items = lookupList.GetItems(query);
for (int i = 0; i < items.Count; i++)
{
string fieldValueAsText = field.GetFieldValueAsText(items[i][lookupField]);
if (!string.IsNullOrEmpty(fieldValueAsText))
{
DataRow row2 = table.NewRow();
row2[0] = items[i].ID;
row2[1] = fieldValueAsText;
table.Rows.Add(row2);
num++;
}
}
return new DataView(table);
}
catch (ArgumentException)
{
return null;
}
}
return null;
}

Don't forget to put your comments if it helps you

Today I got my 22" LCD Monitor

Well working on my old 15" lappy was of no good. As a result Now i'm having back pain and strain in my eyes.
After a month of request today i got my new 22" LCD monitor. Its awesome considering the comfort of viewing everything in a broader view.

Well now i can do some more serious coding, unfortunately i can't use it view my movie collection as I can't carry it home :)