3/12/2010

SharePoint: Hiding the Checked Out Icon from Anonymous Users

 

When document has been checked out, SharePoint will overlay a little icon to show the checked out status. When a user moves their mouse over the icon it will display a popup with the name of the user who has it checked out.

 

      image +   image   =     image

 

And when they mouse over they see:

    image

 

 

Anonymous users can see it too!

You may not want to display it to most users, but very likely not to read only and anonymous users. 

 

 

Hiding it:

There is no out of the box way to turn off this icon, so we need a trick to hide it.  You could use JavaScript or JQuery, but best bet is to use a tiny piece of Cascading Style Sheet (CSS) code.

The code to display the icon looks like this:

      <img src="/_layouts/images/checkoutoverlay.gif" class="ms-vb-icon-overlay" ...

The CSS looks like this:

     <STYLE>
        .ms-vb-icon-overlay { display:none }
     </STYLE>

The only problem with this is that it hides the icon from everyone. A better solution would be to hide it from selected users.

 

So what we do is:

  • Add a style to hide it from all users  (display:none)
  • Add a SPSecurityTrimmedControl to then show it for any user with appropriate permissions (the example below uses the “AddListItems” permission)

 

<style>
    .ms-vb-icon-overlay
    {
      display:none
    }
</style>
 
<Sharepoint:SPSecurityTrimmedControl runat="server" PermissionsString="AddListItems">
  <style>
    .ms-vb-icon-overlay
    {
      display:inline
    }
  </style>
</SharePoint:SPSecurityTrimmedControl>

 

  • If you want this for just a single page, put this CSS in a Content Editor Web Part on that page
  • If you want this for an entire site then add this to your master page somewhere after where SharePoint add its CSS links (SharePoint:CssLink and SharePoint:Theme tags)
<SharePoint:CssLink runat="server"/>
<SharePoint:Theme runat="server"/>
 
    <style>
       <!-- your CSS goes here -->
    </style>

 

 

What might go wrong? 

SharePoint might be using the ms-vb-icon-overlay style for something other than checkout status. I've not run across it yet, but ...

 

 

If you want to hide the icon from everyone on every site on the server?

As a "hack" you can find the icon on the server ("checkoutoverlay.gif") and
  - delete it  (seems to work fine - no red x's)
  - rename it (a better plan)
  - back it up and replace it with a 1x1 transparent GIF (best plan)

This would need to be done on each web front end server (and added to your disaster recovery plan ;-)  )

The file is here:
   _layouts/images/checkoutoverlay.gif

 

.

SharePoint: Strike Out Canceled Events in the Calendar

 

This article is for SharePoint 2007. For SharePoint 2010 you can use the following steps to customize the columns of the calendar, and then use JavaScript from the Color Calendar article.

 

Moving or deleting an event in a calendar is not always the best way to make sure people notice the change. Sometimes it’s better to “cancel” a meeting and then create a new meeting than just moving it in the calendar. The SharePoint calendar list does not have a built in way to do this. So… yet another JavaScript trick!

 

Here’s what we want to do:

image

 

By the way, the following is just a variation of an earlier article on how to color code a calendar. The “big change” is an IF statement to make the formatting conditional. By expanding the calculated column’s formula a bit you can have both color coded and canceled events.

 

The basic steps are:

  • Add a column to the calendar list to indicate that the event has been canceled 
  • Add a calculated column to create the HTML to display the formatted cancelation message. This can be done with HTML or CSS. This example just uses "<s>  text   </s>"
  • Add the new column to the calendar view
  • SharePoint will convert the "<" character into "&lt;" so we need to add a little JavaScript to convert it back. The easiest way to add the JavaScript is with a Content Editor Web Part

Detailed steps:

  • Create or open a calendar
  • Add a new column named "Canceled" (Settings, List Settings) – most likely type will be "Choice" with choices like "No” and “Yes" with a default of “No”
  • Add a new column named "CalendarText"
    1. Column Type is Calculated
    2. Equation is:
      =IF(Canceled="Yes", "<s>" & Title & "</s>", Title )
                   
    3. Data type returned = single line of text
  • If you want to also change the color, then add a FONT or SPAN tag:
    =IF(Canceled="Yes", "<font color=’gray’><s>" & Title & "</s></font>", Title )

  • Modify the existing view, or create a new view such as "Calendar with cancel"
    1. Change the field used for the “Month View Title” AND “Day View Title” AND “Week View Title” to "CalendarText"
                                image_thumb
    2. Save and exit (The HTML for "<s>" will now be displayed. The JavaScript below will be needed to fix the HTML tags)
  • Add a Content Editor web part
    1. Site Actions, Site Settings, Edit Page
    2. Add a Content Editor web part and move it below the calendar web part
    3. Click in the web part click Edit, Modify Shared Web Part
    4. Click Source Editor
  • Paste this JavaScript:

<script type="text/javascript" language="javascript"> 
var x = document.getElementsByTagName("TD") 
var i=0; 
for (i=0;i<x.length;i++) 
{ 
  if (x[i].className.substring(0,6)=="ms-cal") 
  { 
    x[i].innerHTML= x[i].innerHTML.replace(/&lt;/g,'<').replace(/&gt;/g,'>') 
  } 
} 
</script>  

  • Click Save, OK, Exit Edit Mode
  • Add a new calendar item and select a status – canceled events should now be crossed out. 

 

.

3/11/2010

SharePoint 2010: What’s New in Surveys

 

Note: the following is for the November 2009 Beta 2. In this release surveys do not have a ribbon in all screens and retain most of the look and feel of 2007.

 

What’s new?

Almost nothing! The exercise of comparing the two versions almost seems a waste of time due to the few changes, but I have had a number of questions from folks hoping for many new features in surveys. Remember this is the beta and the final release may still have changes.

 

No changes:

  • Settings, Title, description and navigation
  • Audience targeting settings
  • Delete this survey
  • Save as template
  • Manage permissions (new ribbon, but core features are unchanged)
  • RSS settings

New, but common to most SharePoint 2010 lists and libraries - while useful in other lists these often do not add value to surveys

  • Validation Settings
  • Rating Settings
  • Metadata navigation settings
  • Per-location view settings
  • Generate file plan report
  • Form settings

Changed, but common to most SharePoint lists and libraries:

  • Information management policy settings
  • Advanced - Some new wording, and the addition of two new but common items: “Offline Client Availability” and “Dialogs”.

Survey Questions:

  • All the old question types are still there
  • “Business Data” has been replaced with “External Data”
  • New! Managed Metadata

Survey Questions – details…

  • “Enforce unique values” – Interesting new option! This is really useful for lists where each item must have a unique value (I.e. each item is for one State and two items for the state is not allowed). This will have limited value for surveys.
  • “Column Validation”  (only available for Single line of text, Choice, Number, Currency, Date & Time) – used to validate the entered data against a rule (formula) – Example:  “[Amount] > 25” – the formula can reference the current field or any other field in the same item (row / survey response)
  • Currency now has more currency types…
  • Lookup
    • can now display multiple columns from the lookup list – BUT they are not displayed in the survey or the results (this is really a feature for columns in lists)
    • can enforce relational integrity (not of much value to a survey)
  • Yes/No is just as bad as before! (just a bare checkbox that defaults to Yes)
  • Person or Group now allows multiple selection (2007 only lets you select a single user)

 

.

3/07/2010

SharePoint 2010 Available May 12th?

 

 

This says so:

http://sharepoint.microsoft.com/businessproductivity/proof/pages/2010-launch-events.aspx#fbid=vUy2lbxfiO5

“Watch Stephen Elop, President of the Microsoft Business Division, announce the launch of Office 2010 and SharePoint 2010 on May 12, 2010 at 11 a.m. EST.”

 

and so does this:

http://blogs.technet.com/office2010/archive/2010/03/04/get-office-today-or-tomorrow.aspx

For businesses, we will launch the 2010 set of products, including Office 2010, SharePoint 2010, Visio 2010, and Project 2010 worldwide on May 12.”

 

Cool!

Are you ready?

 

.

3/04/2010

SharePoint Events in 2010

 

Joel Oleson has a nice comparison of SharePoint events here:
http://www.sharepointjoel.com/Lists/Posts/Post.aspx?ID=299

 

 

SharePoint Events in 2010

 

SPTechCon

http://www.sptechcon.com/

Feb 10-12, San Francisco

 

Central Region SharePoint Conferences

http://www.sharepointconferencecentral.com

St. Louis  April 12-16, 2010
Omaha April 27, 2010
Kansas City April 29, 2010
Nashville May 10, 2010

 

SharePoint Summit 2010

http://www.sharepointsummit2010.com

April 12-14, 2010 Montreal

 

SharePoint Conference .Org 2010

http://www.sharepointconference.org

April 18-21, 2010 Baltimore, Maryland

 

SharePoint 2010 Evolution Conference

http://www.sharepointevolutionconference.com/

April 19-21 London, UK

 

Best Practices Conference

http://www.bestpracticesconference.com/

August 24-27, 2010 - Washington, DC

 

Experts Conference 2010

http://www.theexpertsconference.com

April 25-28, 2010 Los Angeles

 

Microsoft Tech-Ed North America

http://www.microsoft.com/events/techednorthamerica/

June 7-10  New Orleans

 

Australia SharePoint Conference

June 16-17, 2010 – Sydney, Australia

 

SEA SPC – South East Asia SharePoint Conference – Singapore

www.sharepointconference.asia

October 26 and 27 2010

 

 

 

And in 2011

AUS SPC – Australian SharePoint Conference 2011 – Sydney, Australia

http://spevents.co.nz/AUSPC2011/default.aspx

March 8 and 9

NZ SPC – New Zealand SharePoint Conference 2011 – Wellington, New Zealand

http://spevents.co.nz/NZSPC2011/default.aspx

March 16 and 17

tech-ed 2011!  

http://northamerica.msteched.com/registration?fbid=PUo2p5_ZYzO

May 16-19 in Atlanta

 

SharePoint Conference 2011

October

It’s June 2010 and Microsoft SharePoint Team is announcing SharePoint Conference 2011:

http://blogs.msdn.com/b/sharepoint/archive/2010/06/08/save-the-date-sharepoint-conference-2011.aspx

(Maybe it’s a way of saying… no SharePoint Conference 2010!)

The conference site is already online!  http://www.mssharepointconference.com/Pages/default.aspx

2/19/2010

SharePoint Certification

 

Update (yet again)… Microsoft has updated the  “Skill Measured” sections on two more of the SharePoint 2010 exams. See here:   70-667 and  70-668

Update (again)… Microsoft has updated the  “Skill Measured” sections on two of the SharePoint 2010 exams. See here:   70-573 and  70-576

Update… Microsoft has posted some news on the SharePoint 2010 Exams… but still no links or date. They do state that there are no “upgrade” exams for those who already have the 2007 certs.  See here.

 

Below is a list of the SharePoint exams, the certification you get from the exam and classes to prepare for the exam. Both SharePoint 2007 and 2010 have two exam paths with two exams each. Each of the 2007 exams have hyperlinks to details on Microsoft.com. I will update the 2010 links when they are available.

 

SharePoint 2007

 

Exam Cert

Microsoft Official Curriculum:

 

70-631

MCTS:Microsoft Windows SharePoint Services 3.0, Configuring

5060A: Implementing Microsoft Windows SharePoint Services 3.0 (2 Days)

or

6438A: Implementing and Administering Windows SharePoint Services 3.0 in Windows Server 2008 (2 Days)

 

70-630

MCTS: Microsoft Office SharePoint Server 2007 – Configuration

5061A: Implementing Microsoft Office SharePoint Server 2007 (3 Days)

 

70-541

MCTS: Microsoft Windows SharePoint Services 3.0 – Application Development

None from Microsoft.

I recommend: MA-1038  (I wrote it!)

 

Follow my progress in preparing for this exam here.

 

Are you already 2007 certified? If not, see here,

 

70-542

MCTS: Microsoft Office SharePoint Server 2007 – Application Development

None from Microsoft.

I recommend: MA-1038  (I wrote it!)

 

 

 

SharePoint 2010

These exams will not be available until summer (July 12th?) 2010.

(I get a kick out of the “brain dump” sites that are already advertising “dumps” and “actual test questions” for exams that don’t exist yet!)

Links are not available yet to official MS Pages. All of the following may change…

Exam Cert

Microsoft Official Curriculum:

 

70-667

TS: Microsoft SharePoint 2010, Configuring

10174 - Configuring and Managing Microsoft SharePoint 2010

Will cover configuration of SharePoint 2010 including deployment, upgrade, management, and operation on a server farm.

 

70-668

PRO: SharePoint 2010, Administrator

10231A - Configuring and Managing Microsoft SharePoint 2010

Will cover advanced SharePoint 2010 topics including capacity planning, topology designing, and performance tuning.

 

70-573

TS: Microsoft SharePoint 2010, Application Development

10175A Developing and Customizing Applications for Microsoft SharePoint 2010

Five-day instructor-led course designed for developers with six months or more of .NET development experience. Course covers what you need to know to be an effective member of a SharePoint development team using Visual Studio 2010.

 

70-576

PRO: Designing and Developing Microsoft SharePoint 2010 Applications
 

10232A - Designing Applications for Microsoft SharePoint 2010

Five-day instructor-led training course designed for development team leads who have already passed the Developing on SharePoint 2010 technical specialist exam. The course covers choosing technologies for and scoping a SharePoint project, best practices for SharePoint development, configuring a SharePoint development environment, advanced use of SharePoint developer features, and debugging of code in a SharePoint project.

 

 

70-667 + 70-668 will get you SharePoint 2010 MCITP (Microsoft Certified IT Professional). (according to here)

70-573 + 70-576 will get you SharePoint 2010 MCPD (Microsoft Certified Professional Developer). (according to here)

2/16/2010

SharePoint: How to move a Data View Web Part to another site or server

(Tested for SP 2007 only)

 

A Data View Web Part (DVWP) is a web part created using SharePoint Designer that can display data from just about any kind of data source, inside or outside of SharePoint.  Moving the web part from site A to site B or from server A to server B should be as simple as exporting it from one site and importing it into the other. Should be…

 

If the DVWP is not using data from a SharePoint list, then moving it is pretty easy.

From the site where you created and tested the DVWP:

  1. Click the dropdown arrow in the web part's title bar, click Export and save the file
  2. Move the file to the other server if needed
  3. Open the new site and the page for the web part
  4. Click Site Actions, Edit Page
  5. Click Add a Web Part
  6. At the bottom of the popup window click “Advanced Web Part gallery and options”
  7. Now for the tricky part… find the Import button!
    In the “Browse” bar at the top of the panel there is a dropdown arrow. Click it and click Import
  8. Browse to your exported file and click Upload
  9. Drag the uploaded web part (usually a yellow bar with the name of the web part) to the desired web part zone

 

If the DVWP is using data from a SharePoint list then you have a little more work.

Your web part will have a Globally Unique ID (GUID) to indentify the list. This ID will be different for every list you create.

First get the GUIDs (There are several ways to do this, here’s one…)

  1. Go to the list in the site where you created the DVWP and go to the list or library
  2. Click Settings and List (or library) Settings
  3. Look in the browser’s address bar and you will see something like this:
    http://maxsp2007/sites/training/_layouts/listedit.aspx?List=%7B81588B61%2D860D%2D4487%2DB81F%2DA1846A37954B%7D
  4. Copy everything after the “List=” and paste into Notepad 
    You should now have something like this in Notepad:

    %7B81588B61%2D860D%2D4487%2DB81F%2DA1846A37954B%7D
     
  5. The GUID you copied is encoded. You now need to clean this up
    1. Delete the “%7B” at the beginning
    2. Delete the “%7D” at the end
    3. Do a search and replace and change “%2D” to “-“  (a dash)
  6. Export the DVWP - click the dropdown arrow in the web part's title bar and click Export and save the file
  7. Open the exported file in another Notepad
  8. Search for the GUID you just cleaned up and replace with the name of your web part (“Announcements”)
  9. Search for “ListId” and replace with “ListName”   (capitalization is important here)
  10. Save the file and then import the web part using steps 3-9 in the first set of instructions above.

If you see “Unable to display this Web Part. To troubleshoot the problem…” then you messed something up with the GUID, the ListId vs ListName, or maybe the source list has a column the destination list does not.

 

.

2/13/2010

SharePoint 2010: VHDs Now Available - Updated

 

Updated again!  The RTM (the official release version) is now available… see here: http://techtrainingnotes.blogspot.com/2010/05/sharepoint-2010-evaluation-vhd-download.html

 

Updated: http://techtrainingnotes.blogspot.com/2010/02/sharepoint-2010-vhds-now-available.html

 

I have updated this article with more info about the SharePoint 2010 VHD download…

  • I have added some more info on the install process
  • I have added a list of what I “found” in the VHDs (password, software installed, etc)
  • I have documented some version and setup info (IPs etc)

2/11/2010

SharePoint: Application page to display all sites a user can view

 

This sample project works for both SharePoint 2007 and 2010!

This project is for educational purposes and is to be used at your own risk…

 

 

Display a list of all sites a user has rights to…

The following is a “demo” project to show the workings of several SharePoint API features:

  • Iterating through all sites in a farm
  • Checking user rights
  • Using an application page and the application master page
  • and using a SharePoint grid control (SPGridView)

What’s interesting is that the majority of the code ended up supporting the SPGridView!

 

image

With only a change to the master page (application.master to applicationV4.master) it looks like this in SharePoint 2010 (beta).

image

 

Deployment

Deploy the two files to the LAYOUTS folder on each web front end server. Best practice is to create a folder with a unique name and put your files there. Something like:

C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS\techtrainingnotes\mysites\

 

Then you can test the pages from any site like this:

http://maxsp2007/sites/training/_layouts/techtrainingnotes/mysites/Default.aspx

 

 

MySites.aspx

Here’s the ASPX file. Just two content tags, a dropdown list, two labels and the grid control. Note the @Register for Microsoft.SharePoint.WebControls needed for the SPGridView control.

For SharePoint 2010 you should change application.master to applicationV4.master.

 
<%@ Page Language="C#" MasterPageFile="~/_layouts/application.master" AutoEventWireup="true"
    CodeFile="Default.aspx.cs" Inherits="_Default" %>
 
<%@ Register TagPrefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls"
    Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
 
<asp:Content ID="Content2" ContentPlaceHolderID="PlaceHolderPageTitleInTitleArea" runat="server">
    Site Access List
</asp:Content>
 
<asp:Content ID="Content1" ContentPlaceHolderID="PlaceHolderMain" runat="server">
 
    <asp:DropDownList ID="ddlScope" runat="server" AutoPostBack="True">
        <asp:ListItem Value="Site">The current Site Collection</asp:ListItem>
        <asp:ListItem Value="WebApplication">The current application</asp:ListItem>
        <asp:ListItem Value="Farm">The entire farm</asp:ListItem>
    </asp:DropDownList>
    <br />
 
    <asp:Label ID="lblCount" runat="server" Text=""></asp:Label>
    Sites available to:
    <asp:Label ID="lblUserName" runat="server" Text=""></asp:Label>
 
    <SharePoint:SPGridView runat="server" ID="SPGridView1" AutoGenerateColumns="false" />
    <SharePoint:SPGridViewPager ID="SPGridViewPager1" GridViewId="SPGridView1" runat="server" />
 
</asp:Content>

 

MySites.aspx.cs

Here’s the code for that finds the sites the user has access to. The code that does to real work here is pretty simple. The key methods are:

  • GetSiteCollectionSites(SPSite) – this iterates through the web.AllWebs collection of the SPSite and checks to see if the user has at least the “ViewPages” permission 
     
  • GetApplicationSites(SPWebApplication) – this iterates thorough the Sites collection and calls GetSiteCollectionSites for each site found
     
  • GetFarmSites() – this iterates through all of the WebApplictions in the farm and calls GetApplicationSites for each SPWebApplication found. (Note that this requires higher permissions that most users have so it has to be run using RunWithElevatedPrivileges

The rest of the code is used to setup the SPGridView.

 

using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Administration;
using Microsoft.SharePoint.WebControls;
using System.Data;
 
public partial class _Default : System.Web.UI.Page
{
    DataTable dt = new DataTable();
    SPUser user;
 
    protected void Page_Load(object sender, EventArgs e)
    {
        //get the logged in user
        user = SPContext.Current.Web.CurrentUser;
        lblUserName.Text = user.Name;
 
        //setup the datatable
        dt.Columns.Add("URL", typeof(string));
        dt.Columns.Add("Title", typeof(string));
        dt.Columns.Add("Description", typeof(string));
 
        //get the sites
        string scope;
        scope = ddlScope.Text;
        switch (scope)
        {
            case "Farm":
                GetFarmSites();
                break;
            case "Site":
                GetSiteCollectionSites(SPContext.Current.Web.Site);
                break;
            case "WebApplication":
                GetApplicationSites(SPContext.Current.Site.WebApplication);
                break;
        }
 
        lblCount.Text = dt.Rows.Count.ToString();
 
        //add columns to the grid
        int cols = dt.Columns.Count;
        SPGridView1.Columns.Clear();
        for (int i = 0; i < cols; i++)
        {
            if (i == 0)
            { //add hyperlink column
                HyperLinkField newColumn = new HyperLinkField();
 
                newColumn.HeaderText = dt.Columns[i].ToString();
                newColumn.DataTextField = dt.Columns[i].ToString();
                newColumn.DataNavigateUrlFields = new string[] { dt.Columns[i].ToString() };
                newColumn.DataTextFormatString = "";
                newColumn.SortExpression = dt.Columns[i].ToString();
                SPGridView1.Columns.Add(newColumn);
            }
            else
            { // add all other columns
                SPBoundField newColumn = new SPBoundField();
                newColumn.HeaderText = dt.Columns[i].ToString();
                newColumn.DataField = dt.Columns[i].ToString();
                newColumn.SortExpression = dt.Columns[i].ToString();
                SPGridView1.Columns.Add(newColumn);
            }
        }
 
        //set a default sort
        dt.DefaultView.Sort = "URL";
 
        SPGridView1.DataSource = dt;
        SPGridView1.DataBind();
        //all done
    }
 
 
    // get all webs in a site collection and see if the user has View access
    void GetSiteCollectionSites(SPSite site)
    {
        // all webs in the site collection
        foreach (SPWeb web in site.AllWebs)
        {
            if (web.DoesUserHavePermissions(user.LoginName, SPBasePermissions.ViewPages))
            {
                DataRow row = dt.NewRow();
                row["URL"] = web.Url;
                row["Title"] = web.Title;
                row["Description"] = web.Description;
                dt.Rows.Add(row);
            }
            web.Dispose();
        }
    }
 
    //get all site in an application
    void GetApplicationSites(SPWebApplication wa)
    {
        // all site collections in the application
        foreach (SPSite site in wa.Sites)
        {
            GetSiteCollectionSites(site);
            site.Dispose();
        }
    }
 
    //get all applications in the farm
    void GetFarmSites()
    {   //get all of the services
        SPWebServiceCollection webServices = new SPWebServiceCollection(SPFarm.Local);
 
        SPSecurity.RunWithElevatedPrivileges(delegate()
        {
 
            foreach (SPWebService webService in webServices)
            {   //get all of the applications from each service
                foreach (SPWebApplication webApp in webService.WebApplications)
                {
                    GetApplicationSites(webApp);
                }
            }
 
        });
    }
}

 

If I get the time… I’ll post a longer version of this that adds sorting, paging, a menu bar and some other bells and whistles .

 

.

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.