Sunday, June 21, 2009

Sharepoint 2010 Beta in July

Yes,

Sharepoint 2010 Beta will be out, but to a few lucky guys, Microsoft will launch an invitation-only for few partners for tests.

People, Stay focus.

Thursday, June 18, 2009

Add Custom Column Choice to sharepoint List

This code can help you create custom column on List.
Create a custom Choice field call Year and multiple years choice and add to List.

using (SPSite site=new SPSite("Site Path"))
{
using (SPWeb web=site.OpenWeb())
{
//Validate Field is exist
if (!web.Lists["Shared Documents"].Fields.ContainsField("Year"))
{

SPField customField;
//Creating a new field
MyField = web.Fields.CreateNewField(SPFieldType.Choice.ToString(), "Year");
//Field as required
MyField.Required = true;
SPList list = web.Lists["Shared Documents"];
SPField Year = MyField;
list.Fields.Add(Year);

SPFieldChoice YearField = (SPFieldChoice)list.Fields["Year"];
for (int i = 1990; i < 2021; i++)
{
YearField.Choices.Add(i.ToString());
}
YearField.DefaultValue = DateTime.Now.Date.Year.ToString();
YearField.Update();
}
}
}

Hope you like...

Tuesday, June 16, 2009

Simple CAML Search

There are so excelent projects using CAML and U2U and "Sike Mullivan" on codeproject made a excelent project, and others projects using Ajax with Search List querys.
http://blog.u2u.info/DottextWeb/patrick/archive/2005/05/29/3522.aspx
http://www.codeproject.com/KB/sharepoint/SPQueryBuilderDialog.aspx

But why i did this project, you problably ask, this project is a support in a simple way to create dinamyc search columns of document, without creating views and on Every site can use Custom List and select the columns i want to search in a very simple way.
Usefull...., to experts they have superb projects on dinamyc CAML and need more complexity like see content of Documents an more specific controls problaby not, but simple sharepoint implementation Want to create custom Search List and return direct Documents in a fast way.

On WebPart edit Mode, have 2 Modes "Search columns" and "Output Columns",
On "Search columns"
Select the columns we want to Search,.
Multiple Values are in Dropdownlist.
Date time value, are on 2 Datetime Controls "From/to".
The other Fields are in TextBox.

On "Output Columns"
Select the columns we want to Output.
After Select Columns and make the search will Show on Grid The values we select.



Parameters
We can chose the List from current Web
Select Link to Show List Item or Documents URL
Number of rows by page.


http://simplecamlsearch.codeplex.com/

Hope you like....