Tuesday, October 07, 2008

Manual steps to re-create the Show Desktop icon

Manual steps to re-create the Show Desktop icon on the Quick Launch toolbar
The Show Desktop icon is not an ordinary program shortcut. If the icon is deleted, the procedure for re-creating the icon is not obvious.

To manually re-create the Show Desktop icon, follow these steps:

1. Click Start , click Run, type notepad, and then click OK.

2. In Notepad, type the following text on individual lines:
[Shell]
Command=2
IconFile=explorer.exe,3
[Taskbar]
Command=ToggleDesktop

3. On the File menu, click Save As, and then save the file to your desktop as Show Desktop.scf.

Note Notepad might automatically append a .txt extension to the file name. Remove this extension if present. The file name should be Show Desktop.scf.

The file must now be moved to the correct folder in the user profile to appear in the Quick Launch toolbar. To manually do this, use one of the following methods.

Ref: MSDN

Wednesday, October 01, 2008

Read SharePoint documents using SQL Server query

Retrieve documents form the SharePoint website and display the same in your Windows forms application. No need to use SharePoint webservices or SharePoint Object model. Just run through the query to fetch the documents from the SharePoint using SQL query.
Sample Code:
private void btnload_Click(object sender, EventArgs e)
{
string RootSite = txtsharepointsite.Text.ToString(); // "http://w2czbmlg01:12345/";
// Opening SQL connection for Microsoft SQL Server 2005
SqlConnection MySQLConnection = new SqlConnection(@"Data Source=W2CZBMLG01;Initial Catalog=WSS_Content_12345;Integrated Security=True");
// Passing SQL command text
string strSQLcmd = "SELECT CONVERT(nvarchar(36), Id) AS ID, '" + RootSite + "'+ DirName + '/' + LeafName AS Name, LeafName FROM dbo.Docs WHERE (LeafName NOT LIKE 'template%') AND LeafName LIKE '%.doc' ORDER BY DirName, LeafName";
SqlCommand MySQLCommand = new SqlCommand (strSQLcmd, MySQLConnection);
MySQLConnection.Open();
MySQLCommand.ExecuteNonQuery();
// Dats set
DataSet Docds = new DataSet("Docs");
SqlDataAdapter MySQLAdapter = new SqlDataAdapter();
MySQLAdapter.SelectCommand = MySQLCommand;
MySQLAdapter.Fill(Docds, "Docs");
for (int i = 0; i < Docds.Tables["Docs"].Rows.Count; i++)
{
// list populates
lstdocuments.Items.Add(Docds.Tables["Docs"].Rows[i].ItemArray[2].ToString());
//lstdocuments.DisplayMember = Docds.Tables["Docs"].Rows[i].ItemArray[2].ToString();
//lstdocuments.ValueMember = Docds.Tables["Docs"].Rows[i].ItemArray[1].ToString();
}
}
}


Just create a Windows Form application and add this code in the form load or button click to get the result.

ASP.NET MVC - Sport Facility Booking system

  The project relies on some external service providers. Thus accessing them via their API requires authentication. An API Key need to be su...