The steps below allow you to add a "Welcome to the site, Jane Doe!" welcome message to a page. We did this to insert it to an Announcement list.
1. Using SharePoint Designer, insert a Data View Web Part based on the Announcement list;

2. Select Data > Conditional Formatting;

3. Select any data value and select Create;

4. Select Show Content;

5. Create a condition that reads Title EQUALS [Current User] and select [OK];
 
6. Go back to the Design view;

7. Type "Welcome to the site, " inside one of the Table cells;

8. Switch to Code view;

9. Find the following code:

<ParameterBinding Name="UserID" Location="CAMLVariable" DefaultValue="CurrentUserName"/>

10. Change this code to:
<ParameterBinding Name="UserID" Location="CAMLVariable;ServerVariable(LOGON_USER)" DefaultValue="CurrentUserName"/>

11. Scroll up in the code and find "Welcome to the site, "

12. Change this code to: "Welcome to the site, <xsl:value-of select="$UserID"/>"

13. Save the page.

 
As part of one of my assignments I needed to insert four Content Query Web Parts at the bottom of my custom master page for the site. This was a somewhat easy thing to do in MOSS 2007 and you would do it only once on the master page itself. Well, that’s not the case in SharePoint 2010 anymore. You cannot insert Web Parts on a SharePoint 2010 Master Page at all. However, I found a way around it.

Microsoft might have taken that functionality away from us in what concerns Master Pages. But… they have not taken it away when it comes to page layouts. You can insert web parts in a custom page layout.

The main con about this approach is that if you need those web parts available to all pages being created on your site, then you have to create a copy of each page layout available out there and insert the web parts to all of them. So when your customers create new pages, the web parts are going to be there. (By inserting them once in the MOSS 2007 master page you were done; now you have to replicate the job for all page layouts for which you want those web parts to display.)

Note: As I always emphasize, make sure you are working on a copy of Microsoft’s originals and leave the originals from Microsoft alone.

This is what you need to do:
1. Create some “test” or “hidden” page somewhere on the site where you can create your web parts and edit the page;

2. Insert the web part at any web part zone on the page (it doesn’t really matter where since this is more of a placeholder until you are done creating the web part completely). In the case of custom Content Query Web Parts, do all of the necessary customizations to the web parts, style sheets, CSS rule sets, etc.

3. Download the web part or web parts to your hard drive;

4. Upload the web part or web parts to the site’s Web Part Gallery;

5. Using SharePoint Designer, open your custom page layout
 
6. Go to the location of the page where you would like to insert the web part (it could be a row or cell in a table or a <div>); I usually work in split mode. You may want to use the Code or Design view; it’s up to you and whatever it is easier for you.

7. Select the Insert tab on the ribbon and then select Web Part within the Web Parts group;

8. SharePoint Designer will display a Web Part drop-down menu; locate the web part uploaded in step 4 above and insert it in your page;

9. Save, check in, and publish the page;

10. Go back to your site using Internet Explorer this time (not Designer) and create a page using the modified page layout. Or if you have already created a page using this particular page layout, open it. Make sure the web part is now displaying at the desired location on the page.
 
When displaying dates using Data View or Content Query Web Parts, you might need to format them to the local standards. In order to do that, you may need to use date format functions. But before you can use those, you may need to add a Microsoft schema that does not come by default on your XSL Style Sheet.

I always recommend creating copies of the original files from Microsoft. So I'm assuming that you have created a copy of the original XSL style sheet and you are going to be working on this copy.

Open your XSL Style Sheet. Before modifications, your style sheet should read as follows:
<xsl:stylesheet
     version="1.0" 
     exclude-result-prefixes="x d xsl msxsl cmswrt"
     xmlns:x="http://www.w3.org/2001/XMLSchema" 
     xmlns:d="http://schemas.microsoft.com/sharepoint/dsp" 
     xmlns:cmswrt="http://schemas.microsoft.com/WebParts/v3/Publishing/runtime"
     xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt">
    <xsl:param name="ItemsHaveStreams">

After modifications it should read as this:
<xsl:stylesheet 
     version="1.0" 
     exclude-result-prefixes="x d xsl msxsl cmswrt"
     xmlns:x="http://www.w3.org/2001/XMLSchema" 
     xmlns:d="http://schemas.microsoft.com/sharepoint/dsp" 
     xmlns:cmswrt="http://schemas.microsoft.com/WebParts/v3/Publishing/runtime"
     xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt">
     xmlns:msxsl="urn:schemas-microsoft-com:xslt"
     xmlns:dt="urn:schemas-microsoft-com:datatypes" 
     xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime" >
     <xsl:param name="ItemsHaveStreams">

 
Then insert the format date function in the appropriate line of your style sheet. For example, for today's date:

    <xsl:value-of select="ddwrt:Today()"/>

If you would like to have the date in YYYYMMDD format, you can convert it using the FormatDateTime ddwrt function; for example:

    <xsl:value-of select="ddwrt:FormatDate(string(ddwrt:Today()), 1033, 'yyyyMMdd')"/>

Click here to view a full list of Locale IDs (LCID) that can be used as an aid in setting different formats based on locale.
 
We once had a situation where users would forget to check in files after checking them out from a document library. So someone came with the idea of creating an "annoying" pop-up to remind the users to check the files back in once they were done using them. This is the result of that idea.

1. Edit the page

2. Add a Content Editor Web Part

3. Edit the Contend Editor web part properties, remove the chrome, and make any other changes as desired, rename the web part to something more meaningful than 'Content Editor,' (for example, 'Pop Up'), and then [Apply] and [OK]

4. Select Click here to add new comment at the Content Editor Web Part

5. Locate the HTML icon within the Markup section of the ribbon, select it, and then select Edit HTML Source

6. Type in or copy and paste the code below in the HTML Source web page dialog

    <script type='"text/javascript"'>
        <alert("Alert Message Here")
    </script>

7. Select [OK] and save the page (and publish if publishing is turned on for your site)

Note: Replace the Alert Message Here text with the appropriate message that you wish to  convey.
 
When we migrated from MOSS 2007 to SharePoint 2010, we encountered a little bump on the road: SharePoint 2010 was forcing PDF files stored in a document library to be downloaded before opening them instead of directly displaying them in the browser.

Microsoft incorporated a feature within Central Administration for SharePoint 2010 to prevent files to be opeed within the browser.

Engineering helped to solve it. But once in a while a site would still behave differently than what we wanted it to. So this is what I did in those situations.

First I would make sure that my Adobe was set up for opening the files in the browser. To check this, I would open any PDF file and then I would select Preferences at the Edit menu. Then I would select Display PDF in browser (under Web Browser Options).

Back in my SharePoint site I would try again. If the step above would not solve it, then I would contact someone in Engineering to fix it for me since I didn't have access to Central Administration and that's where the setting I needed changed was.

In case you are curious as of what actually this setting is, I'm talking about the Browser File Handling setting within Manage Web Application within Central Admin, which in our case was set to ‘Strict,’ preventing the files from being opened in the browser. In order for PDF files to be opened in a browser window, that setting should be set to ‘Permissive.’

 
It is possible to create menus in SharePoint without having to use JavaScripts. The main advantage of not using JavaScript is that there's no need to have JavaScript enabled on visitors' computers. The menu will still work seamingless, won't break, and all images will be loaded regardless.
 
Another advantage of the solution presented on this post is that with other solutions you need 2-3 images per menu option: One for when the page is not active, one for when the user points at the menu option (hovers), and one for when the page is active. With the solution presented in this page, you will only need one image per menu option.
 
Finally, the last advantage is no flickering when hovering over the menu options. With other solutions where more than one image is used for each menu option status is a flickering effect when the browser tries to upload the image for each particular status. This flickering is more notorious if the network performance degrades for whatever reason. You can avoid this effect by implementing the present solution.

What you need:

    - Stacked images (one for each menu option)
    - HTML code for links
    - CSS code

Step 1: Create a "Stacked" Image

Picture
The first thing you need to do is create what's referred as a "stacked" image using a graphics tool such as PhotoShop, Fireworks, etc. A stacked image is an image that contains all states (inactive and hover) in one single image stacked one on top of the other. (See image to the left for an example.)

You will need to create one of these images per as many menu options as you may have. Once you have created your images, upload them to the appropriate SharePoint image library.
 
Take note of the actual size of your image (on a related note, all images should be the same exact size to work smoothly). You will need this information in the third step, where you will set the appropriate values on the CSS code. In our example, the image size is 210 x 106 pixels.

Step 2: Create the Markup on the Master Page

The HTML code needed is just a link with an id and a span element wrapped around the link text. You will need to insert it on your customized master page and where you want the left navigator to display.

    <a id="homeMenu" href="<insert link here>" title="Home"><span>Home</span>

The ID given to the link in the example is "homeMenu." This allows you to style the link via your CSS. Then, the actual link text is placed inside a span element, which means that you can hide the link text with your CSS and display the image instead, yet the link still looks like a regular text link to browsers not using the style sheet  (such as, for example, a search engine spider or text-only browser).
 
You will need to insert this markup text for each of your menu options and changing the ID, HREF, and Title values for each option as appropriate.

Step 3: The CSS
 
Finally, to turn the regular text link into a rollover button, you need to modify your CSS style sheet by applying the CSS below.
    #homeMenu
        {
            display: block;
            width: 210px;
            height: 106px;
            background:
url('<insert_link_to_image_here>) no-repeat 0 0;
        }
    #
homeMenu:hover
        { 
            background-position: 0 -106px;
        }
    #
homeMenu span
        {
            display: none;
        }
The display: block line allows you to give the link a width and height, as well as set your button image as a background. The next two lines set the width of the link element to the width of your image, but it also sets its height to half the height of the image (that would be the height of one of the button images in the stacked image). This means that just the top, normal button image will appear within the link by default. The bottom, which is the rollover image, is cut off, therefore remaining hidden.
 
The next line (background-position: 0 -106px;) selects the link's :hover pseudo-class to style the rollover state. What happens is that the background image shifts up, in this case by 106 pixels, which is half the image's height. This hides the normal button image above the top of the link element, revealing the rollover button image within the link. (Another way of thinking about it is as sliding the image upwards within the "window" of the link.) When the visitor moves their mouse away from the link again, the button slides back down 106 pixels, returning to its default position, and revealing the normal button image within the link.
 
The last line, display: none, hides the link text for browsers that support CSS and images.

(Optional) Step 4: Creating More Than One Button
 
If you want or need to create more than one rollover buttons, copy and paste the HTML and CSS as many times as needed. Just remember to give each button a unique ID in both the HTML and the CSS, as well as changing the background image for each button in the CSS.
 
Another alternative would be to style the link text to be in the center of the button image, rather than being hidden. In this case, you would only need one (blank) button image for all the menu options. The only con this approach has is that you lose some control over the look of your button text and the buttons may not look as nice.
 
Last Thing...
 
Don't forget to modify the master page to point to the customized CSS.
 
We have used the formula below to concatenate information such as document name and version, or to create unique IDs in SharePoint.

1. Create a Calculated value column

2. Use the formula below,

        =CONCATENATE([ColumnName1],[ColumnName2])

Note:
Replace the generic ColumnName1 and ColumnName2 in the example above with the name of your respective columns.
 
Once in a while we get a customer who wants us to remove the checkboxes that display at the top on a list view web part.

This can be accomplished within SharePoint 2010 itself and by modifying the applicable list view.

Modify the list and locate the Tabular View section near the bottom. Expand this section and clear the Allow individual item checkboxes option.


Note: After modifying the view, you may need to reapply the view at the web part level on the page where it displays. Sometimes this type of changes are not immediately reflected on the pages, if never. So you have to force the change to go through, in which case you need to edit the page, edit the web part, and select the view at the Select View drop-down list within the List View section of the web part editing tool pane.
 
Use this solution if you are requested to completely hide the View All Site Content menu option from the [Site Actions] menu of a site.

1. Using SharePoint Designer edit your custom copy of the v4.master master page

2. Using SharePoint Designer's Code view, locate the section with an
     id="MenuItem_ViewAllSiteContents"

3. Once you located this section, locate the PermissionsString and change the default value of "ViewFormPages" to "ManageWeb."
4. Save, check in, and publish your custom master page

5. Open the site in the browser and test it with a few users who have been granted different access level. With this new setting, the View All Site Content option will display only for those users who have access to higher features within the site.

Click here for more settings for the Permissions String.
 
Every time we had to start working on a new SharePoint site that had to be customized for look and feel and for which we' would be using the v4.master master page, we always ended up having to clean our own copy of the corev4.css file. One day we got tired of doing this and we decided to export a clean copy of the css file where the whole team could get it from whenever they needed it.

So here's the file I'm talking about.
cleancorev4.css
File Size: 156 kb
File Type: css
Download File