6/24/2011

Book’s done!

 

imageI thought I’d write a little book. I had two weeks of vacation time… Take some of the better stuff from the blog, clean it up and polish it, and may be have 250 pages of content…

Now ten months later I have 400 pages of content and enough stuff for a second book. I can’t let go of this thing! I finally did one final pass of edits and uploaded it to the publisher!

So what did I end up with? This:

  • 401 pages
  • 304 screen captures
  • 83,338 words (including sample code)
  • 3879 lines of sample JavaScript, jQuery and CSS
  • 504,721 characters
  • a ridiculous number of hours
  • At least (I have not counted yet) 75 customizations and tricks that will work in WSS, MOSS, SharePoint Foundation and SharePoint Server. And most should work in Office 365.

 

Book’s done!

The family is relieved… they have not seen me much at all lately. Work, study, teach and then go write - repeat.

Now I can:

  • take some time off
  • fly some model airplanes
  • take a ride in a Tri-Motor Ford with my sons (did that today!) (may have to go back on Sunday and do it again)
  • start another book……………

 

Book’s done!

If you like the articles in this blog, then you should really like the book. More tricks and tips. More details on each one. Both 2007 and 2010 versions for almost every example.

You can order it here today: https://www.createspace.com/3471790

Discount! And as you are a reader of my blog, for at least the next 10 days until the end of July you can go to the link above and get a 25% discount by using this code: 77ULP6VH

 

And on Amazon with free shipping! 

 

 

.

6/23/2011

SharePoint: Edit date and time in one minute increments

 

When working with SharePoint date fields you are offered a Date Picker that let’s you select time to the nearest five minutes.

image

While this works fine for most tasks and meetings, some manufacturing processes need the time set to the minute.

.image

 

I first tried some quick JavaScript tricks to change the dropdown list to include 00 to 59, but it appears that the server side code only expects the dropdown to only have five minute steps and that causes an error on save. The next experiment was to create custom New and Edit forms to allow free form edits. Turns out you don’t have to do anything special to the Display form or the views as they just display whatever was entered.

 

The steps below generally follow what you will find in other blog sites or this MSDN article, expect for replacing the Date Picker fields with Text Box fields.

 

Test this on a “test” list before duplicating on a production list!

 

List Preparation

Before we can enter times, you need to configure your list to support Date and Time. Simply go to the list’s properties and edit the date field to support Date & Time.

image 

Also add a Description to your date fields with a sample of an acceptable date. Remember that the user no longer has a date picker to make sure they select a valid date.  Something like: “Enter dates as mm/dd/yyyy hh:mm AM/PM”

 

Disable Attachments!

      image

The following edits will not work if Attachments are enabled for the list. Go to List Settings, Advanced and disable attachments. I think this error is caused by having two web parts on the same page, each adding some common ID that confuses the page’s JavaScript  (I did a search and found this article, http://support.microsoft.com/kb/953271, but I did not try it’s solution.)

 

Fire Up SharePoint Designer!

SharePoint 2007 (and SPD 2007) example follows – 2010 is farther down the page…

Edit the “New” form  (NewForm.aspx)

SharePoint 2007 steps:

  1. Open SharePoint Designer and open your site   “http://yourserver/sites/.yoursite”
  2. In the Folder List expand Lists and your list
  3. Double-click NewForm.aspx (you may want to make a copy of this file first)
  4. Display the page in Design view
        image
  5. Right-click the existing web part and click Web Part Properties
  6. Expand the Layout section and click Hidden and then click OK
        image
    Note: Do not delete the existing web part!
  7. Click below the existing web part (you may need to experiment to find a spot)
  8. In the menu click Insert, SharePoint Controls and Custom List Form
         image 
  9. Select your list (not just any list with a similar name, your list!)
         image
  10. Select the correct content type
  11. Click New Item Form and click OK
  12. Wait until the fields load
  13. Click on the date field you want to change
  14. If the “Common FormField Tasks” popup is not displayed, right-click the web part and select Show Common Control Tasks
        image
  15. Change the Format As to “Text Box
  16. Repeat for any other date fields you need to change (Start Date and Due Date for a task list)

    Note: In my test environment, SharePoint Designer 2007 occasionally locks up here. You may have to try this more than once.
  17. Save your changes and click Yes if prompted about “customize a page”.
        image
  18. Go to a browser and add a new item to the list
        image 

Note: Several different date formats are acceptable for date entries:
      image

 

Edit the “Edit” form  (EditForm.aspx)

SharePoint 2007 steps:

  1. Follow steps 1 – 11 above except double-click EditForm.aspx and select “Edit Item Form
  2. If the fields are not displayed:
    1. Right-click the new web part
    2. Click Show Common Control Tasks
    3. click the Show With Sample Data checkbox
    4. click Refresh Data View.
    5. image

  3. Continue with step 13 from above…

You were probably expecting something like this:

    image

and got this instead:

    image

Go back to the EditForm.aspx page, switch to Code view and search for this line (my example uses @StartDate):

    <asp:TextBox runat=“server” id=”…” text=”{@StartDate}” …

And then replace @StartDate with

    ddwrt:FormatDateTime(string(@StartDate), 1033, 'G')

The result should look like this

    <asp:TextBox runat=“server” id=”…” text="{ddwrt:FormatDateTime(string(@StartDate), 1033, 'g')}"

Now test and confirm that it now looks like this:

        image

 

 

 

Edit the “New” form  (NewForm.aspx)

SharePoint 2010 steps:

  1. Open SharePoint Designer and open your site   “http://yourserver/sites/.yoursite”
  2. In the Navigation section click Lists and Libraries
  3. Double-click your your list
  4. In the Forms section double-click NewForm.aspx (you may want to make a copy of this file first)
  5. Display the page in Design view
        image
  6. Right-click the existing web part and click Web Part Properties
        image
  7. Expand the Layout section and click Hidden and then click OK
       image
    Note: Do not delete the existing web part!
  8. Click below the existing web part (you may need to experiment to find a spot)
  9. In the Insert ribbon click SharePoint (in the Controls section) and Custom List Form
        image
  10. Select your list (not just any list with a similar name, your list!)
        image
  11. Select the correct content type
  12. Click New Item Form and click OK
  13. Wait until the fields load
  14. Click on the date field you want to change
  15. If the “Common FormField Tasks” popup is not displayed, right-click the web part and select  Show Common Control Tasks
        image
  16. Change the Format As to “Text Box
  17. Repeat for any other date fields you need to change (Start Date and Due Date for a task list)
  18. Save your changes
  19. Go to a browser and add a new item to the list
        image 

Note: Several different date formats are acceptable for date entries:
      image

 

 

Edit the “Edit” form  (EditForm.aspx)

SharePoint 2010 steps:

  1. Follow steps 1 – 13 above except double-click EditForm.aspx and select “Edit Item Form
  2. If the fields are not displayed:
    1. Click the “tab” above the new web part:
        image
    2. Click the Design tab in the Data View Tools section of the ribbon
    3. click the Sample Data checkbox
    4.  

  3. Continue with step 14 from above…

You were probably expecting something like this:

    image

and got this instead:

    image

Go back to the EditForm.aspx page, switch to Code view and search for this line (my example uses @StartDate):

    <asp:TextBox runat=“server” id=”…” text=”{@StartDate}” …

And then replace @StartDate with

    ddwrt:FormatDateTime(string(@StartDate), 1033, 'G')

The result should look like this

    <asp:TextBox runat=“server” id=”…” text="{ddwrt:FormatDateTime(string(@StartDate), 1033, 'g')}"

This edit will display “A.D.” in the Design view, but will display the correct data in the browser.

    image

Now test and confirm that it now looks like this:

        image

 

 

 

 

Hours, Minutes and Seconds?

 

SharePoint will store time to the second. There are no additional changes needed for the NewForm.aspx page, and EditForm.aspx only needs the “g” in the FormatDateTime changed to “G”. The real work will be in also creating a custom DispForm.aspx and custom views.

     text="{ddwrt:FormatDateTime(string(@StartDate), 1033, 'G')}"

 

.

6/16/2011

SharePoint MVP chat; Wednesday, June 22nd at 9am PDT (Noon in Cincinnati!)

 

June 22nd, 12 Noon, online and live!

 

Do you have tough technical questions regarding SharePoint for which you're seeking answers? Do you want to tap into the deep knowledge of the talented Microsoft Most Valuable Professionals?  The SharePoint MVPs are the same people you see in the technical community as authors, speakers, user group leaders and answerers in the MSDN and TechNet forums.

By popular demand, we have brought these experts together as a collective group to answer your questions live.  So please join us and bring on the questions! This chat will cover WSS 3.0, MOSS, SharePoint Foundation 2010 and the SharePoint Server 2010. Topics include setup and administration, design, development and general question.

Please join us on Wednesday June 22nd at 9am PDT to chat with MVPs from around the world. Learn more and add these chats to your calendar by visiting the MSDN event page http://msdn.microsoft.com/en-us/events/aa497438.aspx

 

.

6/15/2011

Finding SharePoint GUIDs using PowerShell

 

Two years or so ago I posted an article on how to find site, web and list GUIDs using a console application or an _LAYOUTS application page. Here’s a little update to do the same thing with a few lines of PowerShell.

New! Finding SharePoint 2013 GUIDs using REST: http://techtrainingnotes.blogspot.com/2014/02/sharepoint-2013-and-office-365-finding.html

2007 version:

[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")
$site = New-Object Microsoft.SharePoint.SPSite("http://yourserver/sites/yoursite")
$web = $site.OpenWeb("yoursubsite")
write-host "Site: " + $site.id
write-host "Web: " + $web.id
$web.lists | Format-Table title,id -AutoSize
$web.Dispose()
$site.Dispose()

2010 version:

$site = Get-SPSite http://yourserver/sites/yoursite
$web = $site.OpenWeb("yoursubsite")
write-host "Site: " + $site.id
write-host "Web: " + $web.id
$web.lists | Format-Table title,id -AutoSize
$web.Dispose()
$site.Dispose()

Note: You could change $site.OpenWeb("yoursubsite")  to $site.RootWeb to get just the top site.

 

Here’s what the output looks like:

image

 

.

6/13/2011

SharePoint: How to change the default home page

This article applies to SharePoint 2007, 2010, 2013, 2016 and SharePoint Online.

Updated 11/25/2015.

 

I frequently get questions on changing the home page or using another page as the home page:

  • Can I have a custom web part page with three (or four or five or…) columns as my home page?
  • Do I have to use the new wiki home page in my Team Site?
  • I want to test a new home page design, but I don’t want to lose the existing home page… (just in case you know…)
  • How can I use a page from my wiki library as my home page?

Below are four ways to set another page as your home page: (all four work for both 2007 and 2010)

  • From Site Settings (If the publishing features are enabled)
  • From SharePoint Designer
  • From code / API
  • From PowerShell

The first two can be used by Site Owners, the second two can only be used for developers and administrators.

 

Important notes for all four methods:

Make sure all of your users have at least read access to the new home page, and if in a library that you have it checked in and published.

Changing the home page changes the URL that some users may have added to their favorites. When sharing links to your site, exclude the home page's library and file name. 
I.e. http://yourserver/sites/yoursite
instead of:
http://yourserver/sites/yoursite/sitepages/home.aspx. 

 

If the publishing features are enabled for a site then:

Site Actions, Site Settings, Welcome Page

(that was easy!)

2007:

image

2010:

image

2013 and 2016:

image

 

From SharePoint Designer:

Go to your Site Pages library, or click All Files and then your library. Right-click the new page and click "Set as Home Page".  (For SharePoint 2007 this only appears to work from SharePoint Designer if the file is in the root of the site. I.e. the same place as default.aspx.)

image

 

Via the API:

C# and VB developers can use the SPFolder.WelcomePage property. See:
http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spfolder.welcomepage.aspx

 

Via PowerShell:

For SharePoint 2010 and later:

$site = Get-SPSite http://yourserver/sites/yoursite
$web = $site.RootWeb
  (or $web = $site.OpenWeb("yoursubsite")
$folder = $web.RootFolder
$folder.WelcomePage = "SitePages/home.aspx"
  (or  $folder.WelcomePage = "default.aspx")
  (or  $folder.WelcomePage = "Shared%20Documents/mycustompage.aspx")
$folder.update()
$web.Dispose()
$site.Dispose()

 

For SharePoint 2007 (the first two lines are different):

[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")
$site = New-Object Microsoft.SharePoint.SPSite("http://yourserver/sites/yoursite")
$web = $site.RootWeb
  (or $web = $site.OpenWeb("yoursubsite")
$folder = $web.RootFolder
$folder.WelcomePage = "SitePages/home.aspx"
  (or  $folder.WelcomePage = "default.aspx")
  (or  $folder.WelcomePage = "Shared%20Documents/mycustompage.aspx")
$folder.update()
$web.Dispose()
$site.Dispose()

 

.

6/12/2011

SharePoint 2007: Use CSS to Add Colors, Borders and Fonts to Web Parts

 

In October of last year I wrote an article on changing the color, borders and fonts for SharePoint 2007 web parts. That article used JavaScript to make these changes while this one will use CSS. The CSS in this article is similar to the CSS needed for 2010 (see here), with one annoying difference… SharePoint 2010 has a CSS class defined for all web parts, s4-wpcell, that represents the main web part area. SharePoint 2007 does not have a class defined for the entire web part table. Instead it has a unique ID for each web part. That is why in the sample CSS below you will see  #MSOZoneCell_WebPartWPQ1 to #MSOZoneCell_WebPartWPQsomenumber . In theory you could have up to fifty web parts on a page, so I guess this could go as high as fifty.

Do you want to change all web parts in all pages, all web parts in a single page or just one web part? Each of these will require a slightly different approach.

  • All web parts in all pages?
      Add the CSS to the master page, either inline or linked to a file
  • All web parts in a single page?
      Add the CSS to the page using SharePoint Designer or a Content Editor Web Part
      (If using a CEWP, add the web part below the web parts to change, i.e. last zone, last web part)
  • Just one web part?
      Add the CSS as for a single page, but prefix all of the CSS entries with the ID of the web part to change

 

The CSS for web parts is quite complicated and may areas that can be changed.

 

A Web Part

Here is a terribly abused web part :-) that has an exaggerated set of colors and fonts to make each area stand out. The CSS for web parts is quite complicated and there are may areas that can be changed. The CSS below will create the example shown here. In your work you would add CSS for only the parts you want to change.

image

 

 

The CSS

As you play with the web part CSS, try one edit at a time. The order you define the CSS can impact the final result. The use of “!important” after the CSS can override existing inline styles.

Notes:

  • You don’t need to use all of the CSS. Pick and choose as needed.
  • Any area can be hidden by using:   display:none
  • This is not a complete list of what you can change in a web part. Search the HTML source of your web part page for ideas, or do a web search to see what others are doing.
  • “#MSOZoneCell_WebPartWPQ5” is the ID of a single web part to change. This is only needed when changing a single web part on a single page. Your web part will have a similar ID, but with a different number.
  • The number in the web part ID may change if the web part is moved on the page.
  • Anywhere there is a background property you can usually set a background image by using:
       background-image:url(' someimagepath ');
  • Colors can be set using color names (“green”) and color numbers (“#00FF00”)

 

CSS to change all of the web parts on a page

To change all pages, add this CSS to your master page. To change a single page, add this CSS to a Content Editor Web Part or edit the page with SharePoint Designer and add the CSS just before the end tag for the PlaceHolderMain <asp:Content> tag. If using a Content Editor Web Part, it should be placed as the last web part on the page. This would usually be the last web part in the last column of the bottom most web part zone.

<style type="text/css">

/* CSS for web parts */


/* === Title bar CSS === */

/* TR - title bar for web part */
.ms-WPHeader 
{
  background-color:green;
}

/*  H3 - Text in title bar of web part */
.ms-WPTitle, .ms-WPTitle a    
{
  color:white !important;
  font-family:"Comic Sans MS";
  font-size:24pt;
}



/* === Web part background CSS === */

/* TD - paging area (i.e. 1 - 5) */
.ms-bottompaging td
{
  background-color:yellow !important;
}    

/* hide or change the gray line above "add new" link */    
.ms-partline
{
  /* display:none; */
  background-color:red;
}

/* "add new" area */
.ms-addnew
{
  background-color:gray !important;
}

/* There could be up to 50 web parts on a page */
/* Use your browser's View Source feature to check your zone names */
#MSOZoneCell_WebPartWPQ1,
#MSOZoneCell_WebPartWPQ2,
#MSOZoneCell_WebPartWPQ3,
#MSOZoneCell_WebPartWPQ4,
#MSOZoneCell_WebPartWPQ5,
#MSOZoneCell_WebPartWPQ6,
#MSOZoneCell_WebPartWPQ7,
#MSOZoneCell_WebPartWPQ8,
#MSOZoneCell_WebPartWPQ9,
#MSOZoneCell_WebPartWPQ10,
#MSOZoneCell_WebPartWPQ11,
#MSOZoneCell_WebPartWPQ12,
#MSOZoneCell_WebPartWPQ13,
#MSOZoneCell_WebPartWPQ14,
#MSOZoneCell_WebPartWPQ15,
#MSOZoneCell_WebPartWPQ16,
#MSOZoneCell_WebPartWPQ17,
#MSOZoneCell_WebPartWPQ18,
#MSOZoneCell_WebPartWPQ19,
#MSOZoneCell_WebPartWPQ20
{
  background-color:lightgreen;
}



/* === Column headings === */

/* color for sortable column headings */
/* there are many "diid" IDs, and this list is not complete */
.ms-vh2 .ms-vb, .ms-vh2 .ms-vb a,
#diidSortEditor, #diidSortAuthor, 
#diidSortCheckoutUser, #diidSortAssignedTo,
#diidSortTaskGroup, #diidSortLinkFilenameNoMenu, #diidSortCustomUrl,
th.ms-vh2-nograd
{
  color:red !important;
  font-size:12pt;
}




/* === List text CSS === */

/* TD - item description text (for odd numbered rows) */
.ms-vb, 
.ms-vb2, 
.ms-vb a, 
.ms-vb2 a
{
  color:white !important;
  font-size:12pt;
}

/*  TR - background alternating (for even numbered rows) */
 .ms-alternating  
{
  background-color:navy;
}

/*  TD - text for alternating (for even numbered rows) */
.ms-alternating .ms-vb, 
.ms-alternating .ms-vb2, 
.ms-alternating .ms-vb a, 
.ms-alternating .ms-vb2 a
{
  color:red !important;
}

/* border (if enabled in the web part's properties */
.ms-WPBorder
{
  border-color:red;
  border-width:thick;
  border-style:dashed;
}



/* background and text for list web parts without column headings */
/* links list, calendar list... */
/* web parts with no items "There are currently no..." */
.ms-summarycustombody td,
.ms-summarycustombody td a
{
  background-color:yellow !important;
  color:red !important;
}


</style>

 

 

CSS to change a single web part

To select a single web part we will use the same CSS as above, but prefix each item with the ID of the web part. To find this ID, use your browser’s View Source feature and search for the name of your web part. Somewhere above this you will find a #MSOZoneCell_WebPartWPQsomenumber that represents your web part.

Here’s what you might find if looking for the “Airshow Pictures” web part:

image 

CSS for web part #MSOZoneCell_WebPartWPQ17:

<style type="text/css">

/* CSS for web parts */


/* === Title bar CSS === */

/* TR - title bar for web part */
#MSOZoneCell_WebPartWPQ17 .ms-WPHeader 
{
  background-color:green;
}

/*  H3 - Text in title bar of web part */
#MSOZoneCell_WebPartWPQ17 .ms-WPTitle, #MSOZoneCell_WebPartWPQ17 .ms-WPTitle a    
{
  color:white !important;
  font-family:"Comic Sans MS";
  font-size:24pt;
}



/* === Web part background CSS === */

/* TD - paging area (i.e. 1 - 5) */
#MSOZoneCell_WebPartWPQ17 .ms-bottompaging td
{
  background-color:yellow !important;
}    

/* hide or change the gray line above "add new" link */    
#MSOZoneCell_WebPartWPQ17 .ms-partline
{
  /* display:none; */
  background-color:red;
}

/* "add new" area */
#MSOZoneCell_WebPartWPQ17 .ms-addnew
{
  background-color:gray !important;
}

/* There could be up to 50 web parts on a page */
/* Use your browser's View Source feature to check your zone names */
#MSOZoneCell_WebPartWPQ17
{
  background-color:lightgreen;
}



/* === Column headings === */

/* color for sortable column headings */
/* there are many "diid" IDs, and this list is not complete */
#MSOZoneCell_WebPartWPQ17 .ms-vh2 .ms-vb, #MSOZoneCell_WebPartWPQ17 .ms-vh2 .ms-vb a,
#MSOZoneCell_WebPartWPQ17 #diidSortEditor, #MSOZoneCell_WebPartWPQ17 #diidSortAuthor, 
#MSOZoneCell_WebPartWPQ17 #diidSortCheckoutUser, #MSOZoneCell_WebPartWPQ17 #diidSortAssignedTo,
#MSOZoneCell_WebPartWPQ17 #diidSortTaskGroup, #MSOZoneCell_WebPartWPQ17 #diidSortLinkFilenameNoMenu, 
#MSOZoneCell_WebPartWPQ17 #diidSortCustomUrl,
#MSOZoneCell_WebPartWPQ17 th.ms-vh2-nograd
{
  color:red !important;
  font-size:12pt;
}




/* === List text CSS === */

/* TD - item description text (for odd numbered rows) */
#MSOZoneCell_WebPartWPQ17 .ms-vb, 
#MSOZoneCell_WebPartWPQ17 .ms-vb2, 
#MSOZoneCell_WebPartWPQ17 .ms-vb a, 
#MSOZoneCell_WebPartWPQ17 .ms-vb2 a
{
  color:white !important;
  font-size:12pt;
}

/*  TR - background alternating (for even numbered rows) */
#MSOZoneCell_WebPartWPQ17 .ms-alternating  
{
  background-color:navy;
}

/*  TD - text for alternating (for even numbered rows) */
#MSOZoneCell_WebPartWPQ17 .ms-alternating .ms-vb, 
#MSOZoneCell_WebPartWPQ17 .ms-alternating .ms-vb2, 
#MSOZoneCell_WebPartWPQ17 .ms-alternating .ms-vb a, 
#MSOZoneCell_WebPartWPQ17 .ms-alternating .ms-vb2 a
{
  color:red !important;
}

/* border (if enabled in the web part's properties */
#MSOZoneCell_WebPartWPQ17 .ms-WPBorder
{
  border-color:red;
  border-width:thick;
  border-style:dashed;
}



/* background and text for list web parts without column headings */
/* links list, calendar list... */
/* web parts with no items "There are currently no..." */
#MSOZoneCell_WebPartWPQ17 .ms-summarycustombody td,
#MSOZoneCell_WebPartWPQ17 .ms-summarycustombody td a
{
  background-color:yellow !important;
  color:red !important;
}


</style>

 

In closing…

There’s always more you can change! Use your browser’s “View Source” feature to explorer the HTML and CSS delivered by SharePoint to see what else you can do. You can also use the add in developer tool bars for Internet Explorer and FireFox to explore the CSS. Some of the cool CSS things you may want to do will probably not work in all browsers, especially Internet Explorer 6, so test, test test.

Also take a look at the CSS reference and branding blogs on the web like these:

http://www.heathersolomon.com/content/sp07cssreference.htm

http://weblogs.asp.net/bsimser/archive/2007/04/01/css-reference-chart-for-sharepoint-2007-pdf-version.aspx

 

.

6/08/2011

SharePoint: Which lists have event receivers?

 

You’ve inherited a SharePoint site. Some of the lists do odd things. Are there event receivers on the list?

If you have access to PowerShell and the SharePoint servers, then you can run this little PowerShell script to find out.

 

For SharePoint 2010:

$site = Get-SPSite   http://yourserver/sites/yoursite
$web = $site.Rootweb
$web.Lists | Where {$_.eventreceivers.count -gt 0} | Select title,eventreceivers | Format-List

image

 

For SharePoint 2007 (or 2010)

[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")
$site = New-Object Microsoft.SharePoint.SPSite(http://yourserver/sites/yoursite)
$web = $site.Rootweb
$web.Lists | Where {$_.eventreceivers.count -gt 0} | Select title,eventreceivers | Format-List

.

You could even start at the farm level and drill down to applications, site collections and sites and document all of the event receivers!

6/05/2011

Book review: Mastering Microsoft SharePoint Foundation 2010

 

Mastering Microsoft SharePoint Foundation 2010

Author: CA Callahan

 

Ok, I'm impressed! I own and I have reviewed a lot of SharePoint books over the years. This one is one of the most complete and useful I have found. Usually after I have read or reviewed a book I eventually give it away in one of my classes or at the local user groups. I'm keeping this one!  (Sybex… do you want to send me some copies for the SharePoint user group?)

Who is the book for? A quick look at the TOC would make you think that it is just for administrators as it has chapters on install, configuration and backup, and it really is a book for administrators. But, it's also one of the best books I seen for Site Owners and Power Users! Of the 16 chapters, a good 7 1/2 are ideal for non-administrators, and those chapters as well worth the price of the book. (currently $34.63 at Amazon)

Even if you are an experienced SharePoint administrator, you will find a lot of useful real-world content. You may even get your money's worth from just reading the hundreds of little gray "sidebars" spread though out the book. (I did.)

While the title says “Foundation”, remember Foundation is the foundation of SharePoint Server. There’s almost nothing in this book that does not apply to all versions of SharePoint 2010.

This book is huge! It's just under 1300 pages. There's a Kindle version available if you don't want haul the big book around. (I still like to dog ear, highlight and write in paper books myself.)

If you want to preview it, chapter 1, the TOC and the index are available as PDFs at the publisher's site: www.sybex.com/go/masteringsharepointfoundation2010

 

I think you might guess I like this book. So much so I'm adding it to the collection of books supplied with my SharePoint 2010 Certification Boot Camp for Administrators class.

 

.

6/04/2011

SharePoint 2010: Add Colors, Borders and Fonts to Web Parts

In October of last year I wrote an article on changing the color, borders and fonts for SharePoint 2007 web parts. Here (finally) I will do the same for SharePoint 2010 web parts. The previous article used JavaScript to make these changes while this one will use CSS.

A 2007 version of this article is here.

Do you want to change all web parts in all pages, all web parts in a single page or just one web part? Each of these will require a slightly different approach.

  • All web parts in all pages?
      Add the CSS to the master page, either inline or linked to a file
  • All web parts in a single page?
      Add the CSS to the page using SharePoint Designer or a Content Editor Web Part
      (If using a CEWP, add the web part below the web parts to change, i.e. last zone, last web part)
  • Just one web part?
      Add the CSS as for a single page, but prefix all of the CSS entries with the ID of the web part to change

The example CSS below is for a single web part example. It will only impact a web part with an ID of “#MSOZoneCell_WebPartWPQ5”. To find this ID, visit the web part page, use the browser’s “View Source” option and search for your web part’s name (“Shared Documents”) and browse up to find the ID, or search for “#MSOZoneCell_WebPartWPQ” and browse down to find your web part’s name. Be aware that this ID may change if you rearrange the web parts on the page!

To use the sample CSS below for all web parts, remove all of the “#MSOZoneCell_WebPartWPQ5” references.

 

A Web Part

Here is a terribly abused web part :-) that has an exaggerated set of colors and fonts to make each area stand out.

image

 

The CSS

Notes:

  • You don’t need to use all of the CSS. Pick and choose as needed.
  • This is not a complete list of what you can change in a web part. Search the HTML source of your web part page for ideas, or do a web search to see what others are doing.
  • “#MSOZoneCell_WebPartWPQ5” is the ID of a single web part to change. This is only need when changing a single web part on a single page. Your web part will have a similar ID, but with a different number.
  • The number in the web part ID may change if the web part is moved on the page.
  • “#MSOZoneCell_WebPartWPQ5.ms…”  vs “#MSOZoneCell_WebPartWPQ5<space>.ms…”
    The space is used to indicate a parent-child relationship. With the space, CSS looks for an element with an ID of “#MSOZoneCell_WebPartWPQ5” and then looks for a child element with a class name of “ms…”. Without the space, CSS looks for single element that has both the ID and the class name.
  • Anywhere there is a background property you can also set a background image by using:
       background-image:url(' someimagepath ');
  • Colors can be set using color names (“green”) and color numbers (“#00FF00”)
  • The .ms-wpTdSpace class name is used to identify the corners or ends of the web part’s title area. If you don’t define anything for these they stay hidden. See the links at the end of this article for ideas for taking advantage of these corner areas. (How about rounded tab-like corners!)

 

<style type="text/css">

/* === Title bar CSS === */

/* TR - title bar for web part */
#MSOZoneCell_WebPartWPQ5 .ms-WPHeader 
{
  background-color:green;
}

/*  H3 - Text in title bar of web part */
#MSOZoneCell_WebPartWPQ5 .ms-WPTitle a    
{
  color:white;
  font-family:"Comic Sans MS";
  font-size:24pt;
}

/* TD - far left and far right (corner) cells of title bar - useful for round corner tricks */
#MSOZoneCell_WebPartWPQ5 .ms-wpTdSpace
{
  /* background-image:url(' someimagepath '); */
  width:30px !important;
  background-color:red;
}

/* web part check box */
#MSOZoneCell_WebPartWPQ5 .ms-WPHeaderCbxHidden  
{
  display:none;    
}


/* === Web part background CSS === */

/*  TD - background for all but title bar of web part */
#MSOZoneCell_WebPartWPQ5.s4-wpcell  
{
  background-color:lightgreen;
  /* border-style:dashed; */
  border-style:dashed;
  border-width:5px;
}

/* TD - paging area (i.e. 1 - 5) */
#MSOZoneCell_WebPartWPQ5 .ms-bottompaging td
{
    background-color:yellow !important;
}    

/* hide the gray line above "add new" link */    
#MSOZoneCell_WebPartWPQ5 .ms-partline
{
  display:none;
}

/* selected (clicked) web part background */    
#MSOZoneCell_WebPartWPQ5.s4-wpActive
{
  background-color:fuchsia;
  border-color:red;
    /* border-style:dotted; */
}    


/* === Column headings === */

/* color for sortable column headings */
#MSOZoneCell_WebPartWPQ5 .ms-vh-div a 
{
  color:red !important;
}
/* color for non-sortable column headings */
#MSOZoneCell_WebPartWPQ5 .ms-vh-div 
{
  color:red !important;
}


/* === List text CSS === */

/* item description text */
#MSOZoneCell_WebPartWPQ5 .ms-vb2, 
#MSOZoneCell_WebPartWPQ5 .ms-vb-user a, 
#MSOZoneCell_WebPartWPQ5 .ms-vb-title a
{
  color:yellow !important;
  font-size:12pt;
}

/*  TR - alternating (#2,#4,#6...) row of web part */
#MSOZoneCell_WebPartWPQ5 .ms-alternating  
{
  background-color:navy;
}

</style>

 

 

Want rounded corners on your web parts?

See this article from Kyle Schaeffer: http://www.endusersharepoint.com/2010/11/29/web-part-style-in-sharepoint-2010/ and this article from Becky Bertram: http://blog.beckybertram.com/Lists/Posts/Post.aspx?ID=123

 

.

SharePoint 2010 Themes

 

The following is just a simple screen capture of a Team Site with each of the out of the box SharePoint 2010 themes. Themes can be selected in Site Actions, Site Settings, Site Theme.

 

You can click each image to see a larger version.

 

Azure

image

Berry

image

Bittersweet

image

Cay

image

Classic

image

Construct

image

Convention

image

Felt

image

Graham

image

Grapello

image

Laminate

image

Mission

image

Modern Rose

image

Municipal

image

Pinnate

image

Ricasso

image

Summer

image

Vantage

image

Viewpoint

image

Yoshi

image

 

 

.

Note to spammers!

Spammers, don't waste your time... all posts are moderated. If your comment includes unrelated links, is advertising, or just pure spam, it will never be seen.