Skip to main content

Posts

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...

SharePoint Interview Questions

1) What are the two base classes a WebPart you are going to use within SharePoint 2007 can inherit from? There are two base classes that a WebPart which is going to be consumed by SharePoint can inherit from, either the SharePoint WebPart Base class or the ASP.NET 2.0 WebPart base class. When inheriting from the SharePoint WebPart Base class your derived WebPart class will inherit from Microsoft.SharePoint.WebPartPages.WebPart. When inheriting from the ASP.NET 2.0 WebPart base class your derived WebPart class will inherit from System.Web.UI.WebControls.WebParts.WebPart. It is considered good practice to use the ASP.NET WebPart base class since the old base class is meant for backwards compatibility with previous version of SharePoint, however there are four exception when it is better to leverage functionality from the SharePoint WebPart base class: Cross page connections Connections between Web Parts that are outside of a Web Part zone Client-side connections (Web Part Page Services C...