Wednesday, December 22, 2010

Getting ImageLink from sharepoint PictureLibrary and displaying in imagecontrol

using (SPWeb web =SPContext.Current.Site.OpenWeb())
SPList Projectimages = web.Lists["ProjectPictures"];
SPQuery myQuery = new SPQuery(); //CAML Query to get only images based on WbsId
myQuery.Query = string.Format("" + strWBSId + "");
// Get a collection of Items based on Query
SPListItemCollection Items = Projectimages.GetItems(myQuery);
if (Items.Count > 0)
foreach (SPListItem item in Items)
imgProjectImage.ImageUrl = string.Concat(web.Url, "/", item.Url.ToString());
imgProjectImage.Attributes.Add("style", "display:block"); //By default image display property was hidden,when the image is there in library then only we are dispalying that image


Disposing SPWeb and SPList(SPObjects)

using (SPWeb web =SPContext.Current.Site.OpenWeb())
SPList Projectimages = web.Lists["ProjectPictures"];
SPQuery myQuery = new SPQuery();
SPListItemCollection Items = Projectimages.GetItems(myQuery)

If we use Using(){} it will automatically dispose all objects.

We need to declare and use all SPObjects in Using clause

Sunday, September 26, 2010

Master Pages in SharePoint 2010

SharePoint 2010 brings a few new master pages that you may want to know about. There are additional master pages to accommodate both the old and new versions of UI. There are also some simplified pages to take note in.
The first master page we will talk about is v4.master. This is the default team site master page used with version 4 (obviously) of the UI. This will be the master page you typically use. It provides the ribbon bar and all of the other new visual UI changes such as the site actions menu on the left side.
If you did an upgrade to SharePoint 2010 and haven’t transitioned to the new UI yet, the old master page is still in default.master. This looks just like the master page you use in SharePoint v3 today. It doesn’t have the ribbon bar and the site actions menu is still on the right side.
The search pages by default now use minimal.master. This is a really slimmed down master page with next to nothing on it. It doesn’t even have navigation. I’m not sure why they opted to use this page in Search Center, but I think it provides and issue with people trying to leave the search center. The Office Web Applications also use this master page but that makes a little more sense because it provides more screen real estate.

The last page I will mention is simple.master. This page is used for login and error pages. From what I understand, it can’t be customized (I have no idea why), but it can be replaced.
I hope this helps if you were curious about the new master pages. I’ll also remind you again that application pages can also now make use of any branded master pages you might have created. I’ll also point out that the master pages all use properly formed XHTML although I am not sure about default.master. I will check that when I get a chance.

Tuesday, September 21, 2010

Difference between sharepoint foundation and sharepoint server

Regarding “SharePoint Foundation” and “SharePoint Server 2010”, the important thing to understand is that SharePoint Foundation is the foundation, and SharePoint Server is simply an optional add-on package of more advanced features. In fact, you cannot install SharePoint Server by itself, because installing it automatically also installs SharePoint Foundation.

So the question is:

What differs between SharePoint Foundation and SharePoint Server?

What version do you need?

The answer depends on your requirements, and not so much on the size of your organization. For example, if you want a good platform for a basic intranet plus collaboration and project management, then SharePoint Foundation may be just what you need. If you need the best web content management, more advanced document management, or tight integration with Excel, Access, and Visio, then SharePoint Server is what you need.

SharePoint Foundation

Here are some of the more frequently used features and characteristics of SharePoint Foundation:

It’s a web based application running on top of Internet Information Services (IIS)
It’s a free 64 bit only add-on to any edition of Microsoft Windows 2008 Server or
Windows 2008 R2
It requires a 64 bit Windows Server operating system
It stores all its data and information in one or more Microsoft SQL Server databases
It displays information using a web page file, usually containing one or more web parts
It has very good document management features, such as version history, custom metadata, and Microsoft Office integration
It has a number of list types that you can use for storing different types of information, such as documents, contacts and calendar items
It enables you to build workflow solutions; for example, sending an email to a given user
When a document is changed or a list column is set to a specific value
It’s perfect for building basic, but effective, intranet solutions, with its built-in web content management features
It’s ideal for collaboration on project data, meetings, social events, blogs, and such

But there are also important features that SharePoint Foundation does not offer. Here are just a few examples:

No built-in advanced search functionality. SharePoint Foundation offers limited search
functionality, but still it will only allow users to search within the current site and sites below it
No advanced web content management features, such as publishing control, targeted
information, and multilingual support
No advanced document management features, such as global document IDs, document sets, and document policies
No record management of legal and other important documents
No support for displaying InfoPath forms in a web browser
No support for displaying MS Excel spreadsheets as web parts
No support for displaying MS Visio 2010 diagrams as a web part
No support for key performance indicators (KPIs)
This is where SharePoint Server 2010 comes in.

SharePoint Server 2010

SharePoint Server 2010 uses the same types of web sites and features as SharePoint Foundation but adds a lot of functionality. In addition to the previous list, SharePoint Server 2010 also provides the following features:

Use the global search functionality to find any type of information, regardless of type and location, based on content or metadata properties
Use Social Search to find people based on their typical activities and interests
Target displayed information to one or more user groups
Import user properties from AD, and make them searchable
Use advanced content management features for public Internet sites or portal intranet sites
Allow globally unique document IDs and document sets
Display and use InfoPath forms with a web client, using the Forms Service
Display Microsoft Excel spreadsheets and charts in a web part, using Excel Services
Display Microsoft Visio 2010 diagrams directly on a web page, using the Visio web part
Search, display, and edit content in external databases, such as SAP, Oracle, and Microsoft SQL, using the Business Connectivity Service
Give each SharePoint user a personal website, for both private and public use
Create dashboards with scorecards and key performance indicators
Currently rated 5.0 by 1 people

Friday, August 13, 2010

Changing i like it ,change notes butoon to small icons in sharepoint 2010 ribbon

To convert the large social buttons to smaller ones you simply have to modify the following:

Within your custom Master Page search for: “GlobalSiteLink3”

Simply Add “-mini” to the control ID

Original Large Control:

New Small Control ID:

If you want to make the small buttons horizontal versus vertical simply add the following to your custom CSS:

white-space: nowrap;

Wednesday, August 11, 2010

Back up and Restore

1)Create content database backup for particular sharepoint website
2)Delete web application along with content database if it is same server
3)restore the back up what you have create in first step
4)Create new web application,While creating give database name as same as what you ahve restore.
5)after creating web applicationdon't create any site collection
6)Just close the window and open site with url directly in browser
7)The backup site will open in new web application(new url) same as like deleted site.

Monday, August 9, 2010

Column Validation in SharePoint 2010

The ability to easily validate the column values entered into list items is a welcome addition to SharePoint 2010. I'd like to walk thru 2 simple example s of how to use column validation, at the column level, then at the list level. I'll then point out some specific notes about this feature.

Simple Example #1 - Column Level
Create a new column on a list, and click "Column Validation":

2.Add a validation Formula, and a message that will display if validation fails:

3.Create a new item, and enter a value that will not validate. Click OK. You will see your failure message:

Simple Example #2 - List Level
In the List Settings, click on "Validation Settings"

Enter a validation formula to apply to this list. Click Save.

Create a new list item, entering in values that will not validate. Click OK. The item does not save, but the User Message doesn't appear either. I assume this is a bug, and it ought to be fixed before RTM.

Field Types
In this simple example we used a "Single Line of Text" field type. The following field types can be validated with the "Column Validation" feature:
Single Line of Text
Choice (single only)
Date & Time

You can only compare column values to one another in a list level validation.
A validation formula at the column level cannot include any other columns besides itself. For example, [Column1]>[Column2] is an invalid formula and SharePoint will not allow it to be used at the column level. In this case, you want to use list-level validation.
There is only one formula available at the list level.
The formula syntax is similar to that used in Calculated Columns
There are a few dozen functions available - I have not tried every one. One interesting thing to note is that SharePoint 2010 would not allow me to use the TODAY function, even when validating a Date field. [DateColumn]>TODAY is not a valid validation formula.

What if you have both column level validation and list level validation?
The column level formulas will be evaluated first, then the list formulas
What if the column and list level validations are in conflict?
Example - at the list level, you require that [Text1] = [Text2], but each column has it's own validation; [Text1]="AAA", and [Text2]="BBB". In this case, it will be impossible to actually submit a list item. The column validations are evaluated first, but if the values validate here, they will of course fail the list validation.
What if the list level validation includes columns not included in a particular content type?
If a column used in the list formula isn't available in the current content type, validation will always fail. This means that if you have multiple content types in your list, you should not validate at the list level for a column that is not included in all content types on the list. These columns can only be validated at the column level.

Site Columns
You can set validation on custom columns of the field types listed above
You can override the validation of a site column at the list level

Items To Investigate
How does validation behave with page fields in a Pages library on a publishing site?
How does validation behave in Office client applications?
Is validation available in the Site Directory? Does it work at site creation time?
Can we use regular expressions in a validation formula?