Skip to main content

Posts

Showing posts from January, 2011

SharePoint Tip / Thought of the Day WebPart

I have posted a new web part on codeplex a brief description is provided below URL: http://tod.codeplex.com/ The "Thought / Tip of the Day" Web Part selects a random item from the specified SharePoint Custom List or a selected RSS Feed and displays a picture, a title and a thought/tip. The Web Part can be used with WSS 3.0, MOSS 2007 and SharePoint 2010. You can configure the following web part properties: • the SharePoint list containing the thoughts / tips • RSS Feed URL for external thoughts / tips • the List fields corresponding to the picture, title and thoughts / tips • a picture (Optional) • show a new thoughts / tips every day or on every page refresh This allows you to display random data contained in any SharePoint List by specifying the desired SharePoint List name and the desired list column names. Installation Instructions: 1. download the Thought / Tip of the Day Web Part wsp file 2. Install the wsp file and deploy to server farm. 3. If y...

Importing documents from SQL Server to Document Library

Recently I had come across a requirement where we had to migrate a existing SQL server tables data to a document library. The SQL table was containing documents (blob field and its meta data) i wanted to share with you all the small script we had used for the same string connstr = @”Data Source=.;Initial Catalog=AdventureWorks;Persist Security Info=True;User ID=sa;Password=sa”; SqlConnection conn = new SqlConnection(connstr); conn.Open(); SqlDataAdapter da = new SqlDataAdapter(); da.SelectCommand = new SqlCommand(“SELECT * FROM [dbo].[ImageStore]“, conn); DataSet ds= new DataSet(); da.Fill(ds); byte [] blob = ( byte [])ds.Tables[0].Rows[0][ "imageContent" ]; using (SPSite destinationSite = new SPSite( "http://YourSite" )) { using (SPWeb = destinationSite.OpenWeb( "http://YourSite" )) { SPList destinationDocuments = destinationWeb.Lists[ "Documents" ]; string fileName = "mydoc.jpg" ; string relativeDestinationUrl = des...