Archive for October 2010

 
 

RYG Indicators in Any SharePoint List

You guys know me. When I say “this is the heat,” you know it is really the heat.

Our new best friend, Christope, at PathToSharePoint.com is bringing the heat.

What he has here is a web part that lets you poke a SharePoint status indicator into any SharePoint list. And he does it the way this robot has always liked to do things, by making SharePoint do what you want it to.

First create a list with a “status” column. Make it a choice and make your choices:

(1) Red
(2) Yellow
(3) Green

Now, we’re going to use the numbers in a calculated column so be sure to use the (x) format. The rest of the verbiage is irrelevant.

We’ve talked about composing HTML in calculated columns before. I’ve always just used a datasheet view to to click and drag over the column and pasted it into a CEWP in source mode and called it done.  So add a calculated column and call it whatever you want but use this for the formula:

=”<DIV><IMG src=’/_layouts/images/KPIDefault-”&(3-RIGHT
(LEFT(Status,2),1))&”.gif’ /></DIV>”

Note how the right\left string magic sheds everything but our status color index number.

Now, it just so happens that SharePoint’s silly little Red, Yellow, Green indicators are found at the URL embedded in the resulting img tag. They are numbered 0, 1 and 2 so the formula just subtracts our index number from 3 to get the necessary text and mashes is all together.

Add some items to your list and look at the view and you’ll see that the HTML appears flawlessly.

Then, Christophe seals the deal by giving us the JavaScript (here) that converts this gobbledygook into pretty little indicators at run time. Drop the JavaScript in a second CEWP and put it on the page and your calculated HTML is converted into a rainbow of colors.

Ouch, that’s hot.

-robot

SharePoint 2010 MySite: Community Report

The deployment of My Sites is among the most difficult desicsion to make in enterprises with a timid or conservative management style. I thought I would look through the community to see if we have any consensus about what to expects or how to avoid pitfalls.

First of all, our new best friend, Chandima has a nice look here. He identifies benefits, such as connectability and discovery, and he also describes some of the overhead on performance and storage.

He also describes the SharePoint 2007 SSP approach to managing the permission to create a MySite.

Things will be different in the 2010 solution. There’s no SSP servers, only dedicated service servers. I sense that throttling MySite creation is one thing we might use to mitigate the management timidity we spoke of, I supposed we’ll be looking through the profiles service to find the permissions to create new MySites.

-hth
robot

Root Level Site Collections

I’m finding a number of good sources on the topic of creating your site collection at the root level of your web applications.

Consider this requirement: In an existing SharePoint operation with a top level site, you need to create a new site collection in a new database with a simple URL like:

http://MyPortal.com/MyNewSiteCollection

Using your standard Central Admin interface, your new site collection will end up under:

http://MyPortal.com/MyNewSiteCollection/Sites or
http://MyPortal.com/MyNewSiteCollection/Personal

Well, of course, that because “Sites” and “Personal” are managed paths in the default install. We’ll need to create a new managed path at the server’s root level and then add our site to it.

Our new best friend, Cory, give us a good start here. He explains how to create the site collection using explicit inclusions of both the root and the top level site.

Then, our other new best friend, Ben, explains, here, that what we need is a new managed path using an explicit inclusion.

I’m not sure I absolutely understand the difference, at least in SharePoint 2010.

Like Cory says, the server won’t display the site at the root if it’s configured as a wildcard excusion. For example, I have a site at:

http://MyServer

If I do like Cory says and delete the root managed path and recreate it with a wildcard inclusion, we can see that the root site quits working. Furthermore, no URL defined as a wildcard exclusion will display a site.

So,  in Central Admin, I go to Application Management | Manage Web Applications. I select my SharePoint – 80 and click on Managed Paths. 

 Add my new site with an explicit inclusion and click Add Path:

Then, when you go to Application Management | Create Site Collection, you can see that the managed path is available in the pull down list and that it will create your new site with the template you select at the root of your new managed path.

 

The next thing we need to do is make sure the database gets built into it’s own distinct database. For this, we visit Application Management | Manage Content Databases. Here we click Add a content database and give the new database an appropriate name. Then we go into all the existing databases and set their Maximum Number of Site Collections to the Current Number of Site Collections. This will assure us that the new site collection gets it’s content written into the new database. After it’s created, change the numbers again to make sure future site collections poke their data into the appropriate database.

hth
-robot

Link to Create Instance of Content Type

Sometime, you want to give your user a link to create a document in a library somewhere using a document template tied to one of the library’s content types.

Our new best friends at SharePointKings.com gave us a head start on figuring it out. I just had to pull out my ASCII character map to decode all the escape characters and found they mostly didn’t matter.  So, using our handy dandy content editor web part, we can drop this code in place to cross this one off our list:

<A onfocus="OnLink(this)" HREF="XXX Item 1 XXX" onclick=
"createNewDocumentWithProgID('XXX ITEM 2 XXX', 'XXX ITEM 3 XXX',
'SharePoint.OpenDocuments', false)">Create Instance of Content
Type in Specified Library</A>

Just replace my place holders as follows:

“XXX ITEM 1 XXX” = Relative path to template in \Site\Subsite\library\forms\content type\ folder, i.e.

"/SiteDirectory/My%20Site/My%20Library/Forms/My%20Content%20Type/
Template%20File%20Name.docx"

 I’m using %20 for blank spaces. You can browse to the folder in Explorer view to be sure you have it right. Just swap the \s in favor of /s

‘XXX ITEM 2 XXX’ = Full path to template in \content type folder. In my example above, that would be:

'http://MyDomain.com//SiteDirectory/My%20Site/My%20Library/
Forms/My%20Content%20Type/Template%20File%20Name.docx'

Use single quotes.

‘XXX ITEM 3 XXX’ = Full path to host library. In my example above, that would be:

'http://MyDomain.com//SiteDirectory/My%20Site/My%20Library'.

Again use single quotes.

I’m not sure what the OnFocus= does for us and I can’t testify to the efficacy of the relative vs. full paths but this format does the trick for me.

hth
-robot

SharePoint 2010: Blank Web Part Pages

You guys that know me, know I like my screens as blank as possible sometimes and, earlier,  here, we built a content editor web part that made everything disappear except a Toggle Edit link that let you get to the web part controls.

Well, in SPF 2010, this is all blown up. No sweat, though, because it’s easy enough to open the site in SharePoint Deisgner and create a new .aspx page and drop a web part zone on it.

But you’ll still want to be able to edit the page in the browser so the new JavaScript link for edit is:

<a href=javascript:ChangeLayoutMode(false);
mce_href="javascript:MSOLayout_ToggleLayoutMode()">Edit</a>

I have not figured out how to toggle out of edit. I also have not figured out how to get the typical sharepoint styling on the page.

Sounds like an update might be in the offing.

-robot

Source for Cool Excel Functions

Two cool things here.

First, there’s a slam dunk intro into Excel programming; your first module and first custom function in less than one minute. Be sure to replace the silly left and right quotation marks with ordinary quotation marks once you open the VB Editor. I’ve plagerized his code below if, like me you’re just too lazy to click. I eliminated the line continuation character and the silly quotes.

Second he has a “Buy Me a Beer” icon that loads his Paypal page. You gotta wonder what kind of metrics he builds using that tool.

hth
-robot 

Function GetAddress(HyperlinkCell As Range)
GetAddress = Replace(HyperlinkCell.Hyperlinks(1).Address, "mailto:", "")
End Function