2/28/2012

The SharePoint Site Icon and PowerShell

 

Governance and the desire for a consistent user interface may require you to occasionally change or reset the image used for the site icon.

 

First a few notes on the site icon

  • Sometimes Microsoft calls it the Site Icon and sometimes the Site Logo
     
  • The site logo is changed using Site Actions, Site Settings, Title, Description and Icon
        image
     
  • If the URL is blank in the top level site, then the default icon is used 
        image   (this icon is found here: /_layouts/images/siteIcon.png)
     
  • If the URL is blank in a sub site, the the icon from the top level site is used (not the icon from the next parent up)

Example:

  Top level site URL is blank, so the default icon is used (siteIcon.png)
  Subsite 1’s URL is supplied and has a custom icon
  Subsite 1A’s URL is blank, and the site display’s the top level site’s icon (siteIcon.png)

Then the icon for the top level site is changed to “newIcon.png”":

  The top level site displays the newIcon.png image
  Subsite 1’s URL is supplied and has a custom icon, and is unchanged after the change to the top level site
  Subsite 1A’s URL is blank, and now display’s the top level site’s new icon (newIcon.png)

 

Using PowerShell to document icon usage 

PowerShell can be used by administrators who have access to the SharePoint web servers to search and update SharePoint. The following scripts use the SharePoint 2010 cmdlets. Similar scripts could be written for SharePoint 2007 if needed.

 

The following PowerShell will list all of the sites in a site collection and their icons:

$site = Get-SPSite http://urlToYourSite
$site.AllWebs | foreach { $_.Url + "   Logo URL: " +  $_.SiteLogoUrl }

The result might look like this for the first example above:

http://intranet   Logo URL:
http://intranet/subsite1   Logo URL: /SiteAssets/CustomLogo.jpg
http://intranet/subsite1/subsite1a   Logo URL:

 

And after changing the top level’s icon to “newIcon.png” might look like this:

http://intranet   Logo URL: /SiteAssets/NewIcon.png
http://intranet/subsite1   Logo URL: /SiteAssets/CustomLogo.jpg
http://intranet/subsite1/subsite1a   Logo URL: /SiteAssets/NewIcon.png

If you want to dump all sites in a web application you could use this PowerShell:  (all one line)

Get-SPWebApplication "http://intranet" | Get-SPSite "| Get-SPWeb | 
foreach { $_.Url + "
Logo URL: " + $_.SiteLogoUrl }

Or for all webs in all site collections in all applications:

Get-SPWebApplication | Get-SPSite | Get-SPWeb | 
foreach { $_.Url + " Logo URL: " + $_.SiteLogoUrl }

 

Changing the Site Icon

This following PowerShell script sets the icon in every subsite of a site collection to an icon stored in the Site Assets library of the top level site. 
  NOTE 1: This will change the top level site and EVERY subsite in the site collection. 
  NOTE 2: There is no undo.
  NOTE 3: The users of all of the subsites will need at least Read permissions to the icon file.

$site = Get-SPSite http://urlToYourSiteCollection
$site.AllWebs | foreach { $_.SiteLogoUrl = "/SiteAssets/NewLogo.jpg"; $_.Update() }

If you set the SiteLogoUrl to "" then all the sites revert to the default site logo.

$site = Get-SPSite http://urlToYourSiteCollections
$site.AllWebs | foreach { $_.SiteLogoUrl = ""; $_.Update() }

If you wanted to set the URL so each site would point to its own custom image in its own library then you can add “../../” to the URL:  (the following is all one line)

 $site.AllWebs | foreach { $_.SiteLogoUrl = "../../SiteAssets/NewLogo.jpg"; 
$_.Update() }

 

.

2/25/2012

Cincinnati SharePoint User Group

 

Cincinnati SharePoint User Group

The next meeting is Thursday, March 1st, at 6:00 PM

http://www.CincinnatiSPUG.org

 

Topic:  Managed Metadata Services - Real World experiences how to leverage the feature within SharePoint from a PowerUser and Administrator point-of view!

Speaker:  Tony Maddin

 

 

.

2/20/2012

SharePoint Saturday Dayton! June 30th, 2012

 

 

We’ve had SharePoint Saturdays in Columbus, last year we had our first in Cincinnati, and now we have one coming up in Dayton!

There’s not much to report yet… but save the date!  June 30th, 2012.

 

Check here for updates:

http://www.sharepointsaturday.org/dayton/default.aspx

 

and follow #SPSDAYTON on Twitter.

 

.

SharePoint: Group by Year or Month in a View

 

The following is for SharePoint 2007, SharePoint 2010 and SharePoint Online.

 

Grouping by Year

Grouping by year is pretty straight forward, just add a calculated column to your list to display the year and then group on that column in a view.

Steps:

  1. Add a new column to your list or library
    1. 2007: Click Settings and then Create Column
      2010: In the ribbon click the List or Library tab and click Create Column
    2. Select “Calculated column (calculation based on other columns)”
        image
    3. Enter this formula: 
        =YEAR([yourdatecolumn])      example: =YEAR([Due Date])
        image
    4. Create or edit a view and in the Group By section select your new calculated column
        image
    5. Set the return type to text:
        image
    6. Save the view and test

        image

 

Two Problems!

What’s with the 1899 year and why the commas? The commas are because SharePoint, in spite of our selecting “Single line of text”, still thinks the digits are a number. The 1899 year is from items with no date entered.

Fixing the commas…

Easy, just force the result to be text by prefixing the year with an empty string:   “”
=  “”  &  YEAR([Due Date])

    image

Fixing the 1899 / no date problem…

Just add an ”IF” to the formula to test for the date.

    =IF(  [Due Date]="" ,  "No Due Date",  ""&YEAR([Due Date])  )

    image

The result:

image

 

If you want the “No Due Date” listed first, then just add a space before “No”:

  image

 

  image

 

Grouping by Month

The Group By option in a view groups on the entire field. There is no way to group on a part of a field, such as just the month and the year of a date. We can get there by creating a calculated column or two and then grouping on the calculated columns.

We can pull the Month using a formula similar to the one above by using MONTH(). You will need both the year and the month and as SharePoint will sort from left to right you will need to build a string that looks something like “2012/02”, “2012 02” or “2012 / 02”.

When we combine this with the “empty date IF” from above you will get something like this:

  =IF([Due Date]="","No due date",YEAR([Due Date])&"/"&RIGHT("0"&MONTH([Due Date]),2))

 

The final view:

    image

 

Both Year and Month?

If you wanted to group on Year and then on Month you can:

  1. Create both columns described above
    Month:  =IF(  [Due Date]="", "No due date", YEAR([Due Date])&"/"&RIGHT("0"&MONTH([Due Date]),2))
    Year:     =IF(  [Due Date]="", "No Due Date", ""&YEAR([Due Date])  )
  2. Create a view and first group on Year and then group on Month

The result:

    image

 

Year, Month and Day?

Sorry, but SharePoint views only support two levels of grouping. If you really need to do this then you can use SharePoint Designer to create a Data View Web Part to group to any number of levels. See here: http://techtrainingnotes.blogspot.com/2011/01/sharepoint-group-by-on-more-than-2.html

 

 

Group Headings

If you want to get rid of the group heading then see this article:

http://techtrainingnotes.blogspot.com/2009/06/sharepoint-removing-group-headings-from.html

That article is for SharePoint 2007. There are both 2007 and 2010 versions available in my book.

     image

.

SharePoint Customization for the Site Owner – The Class!

 

This Wednesday I will be offering a class and hands-on lab based on my book,  SharePoint 2007 and 2010 Customization for the Site Owner, at MAX Technical Training.

In the morning we will see how these customizations are done, what you can and cannot do, and do a few hands-on walk troughs. In the afternoon you can use our lab computers, or if you have remote access to your SharePoint site you can use your own site, to follow step by step labs to apply what you have learned. You may also use the lab time to apply anything in the book to your site while I’m there to help.

The class and the book apply to SharePoint 2007, SharePoint 2010 and SharePoint Online / Office 365. The lab computers will include access to all three versions!

 

And of course, you will get a free copy of the book!

 

Click here to sign up: http://www.maxtrain.com/Classes/ClassInfo.aspx?Id=33292

 

MS-SPFP SharePoint Customization for the Site Owner - Enhancing the User Interface and Productivity

A one day, hands on, quick way to enhance your SharePoint sites presented by MAX's own Microsoft SharePoint MVP. You can choose to do your customizations (labs) in SharePoint 2007, SharePoint 2010 or SharePoint Online / Office 365. The morning will get you the tips and background info you need while the afternoon will be all hands on labs!

As part of this class you will also receive a copy of Mike's book, SharePoint 2007 and 2010 Customization for the Site Owner. While we can only explore a handful of these customizations in a day, there are over 75 customizations in the book to further enhance your sites.

 

.

2/18/2012

PowerShell Saturday! -- Interested in a PowerShell user group in Cincinnati?

 

PowerShell Saturday in Columbus

The first ever PowerShell Saturday will be held in Columbus, OH on March 10th. If you have not already registered, then it’s too late! It’s a sell out! But you might want to check the link below to see if they open up any more tickets.

    Tickets: http://www.eventbrite.com/event/2860436643/eorg

    I got my ticket!

 

PowerShell in Cincinnati?

So… would you be interested in either a Cincinnati area PowerShell user group and / or a Cincinnati PowerShell Saturday? Post a response below and let me know. (All posts are moderated, so if you don’t want your post public, just say so.)

 

Mike

 

.

2/13/2012

SharePoint: Finding the Site GUID

 

Had a nice quite evening planned, and then someone sends me in search of a wild goose... 

Because of a security issue they could not use my little GUID getter tool on their site and they were looking for some other way of getting a site GUID.

The wild goose hunt paid off as I found two…

For those who have bought my book, you may want add a note on page 307 to see this article.

 

1) Wiki home page:
Works for SP 2010 only: Display a Team Site home page (a wiki home page, home.aspx) that has at least one list web part, view the source of the page (right-view source) and search for "RelatedWebId"  (you could temporarily add an Announcements or library web part to the page)

    WebPartWPQ2_RelatedWebId="{f70832a4-5d0d-4265-a344-ea10a0007160}"

2) Tree View:
Works for both SP 2007 and SP 2010: Go to Site Actions, Site Settings, Tree View and enable Tree View. Then go to any page, view source and search for "ListNode:"

   spNavigateHierarchy(this,'','30:ListNode:f70832a4-5d0d-4265-a344-ea10a0007160:740...

 

Here's one for the PowerShell users that requires admin access to the servers:


Open "SharePoint 2010 Management Shell"  (PowerShell for SharePoint)
Enter:
  $site = Get-SPSite  http://yourserver/sites/yoursitename
  $web = $site.AllWebs["yoursubsitename"]     or  $site.RootWeb   for the root site
  $web.ID
    Guid
    ----
    f70832a4-5d0d-4265-a344-ea10a0007160

 

I guess the wild goose chase at least got me another blog article.  :-)

 

.

2/09/2012

SharePoint Error: This item is no longer available. It may have been deleted by another user

 

Error: “This item is no longer available.  It may have been deleted by another user.  Click 'OK' to refresh the page.”

image

 

A Missing Permission

This error is caused by either out of date pages that need to be refreshed, as you would expect from the message, or from a missing permission. If the user does not have the “View Application pages” then they cannot get to “forms, views and application pages”. Although not listed in the permission page, they also are not allowed to see dropdown menus from list items displayed in a web part.  I.e. they can see the web part, they can see the list item or document, but they can’t display that item through a form, view or dropdown. In a library they can click the document and open it.

   image

 

The “View Application pages” Permission

You might uncheck this permission when you want users to visit a home page of a site, but not navigate directly to lists and libraries. To give these users access to content you would add web parts to the home page for these lists.

 

The “View Application pages” Permission and the Access Denied error

Important! When disabling this permission you should create your list web parts to only display data. Do not display links to the item’s forms. If they click a link they will get this error:

    image

 

When Creating a Web Part View

For list web parts:

When creating list web part views for users without the “View Application Pages” permission always select one of the options without a link.

    image

 

For library web parts:

When creating library web part views for users without the “View Application Pages” permission always select one of the options with a “linked to document”.

image

The document will then open, be opened in an Office Web App or be downloaded. The user will not be able to get to a form (or get the error messages).

 

.

SharePoint: How to add JavaScript to a Content Editor Web Part

 

The following may be a bit redundant as it has been part of many of my “JavaScript hacks” posts, but I’m asked so often I thought I would put it in a article by itself.

 

The Content Editor Web Part (CEWP)

SharePoint 2007 gave us a nice little web part to insert HTML, CSS, JavaScript, and even just some text, in any web part page. SharePoint 2010 “broke” this web part a bit by trying to “fix up” our code. Add a little JavaScript to a CEWP and you will get this message:

    clip_image002

The message may mean that it did nothing to your code, reformatted your code (in strange ways), or completely removed your code!

Here’s a before and after of a “reformat”: 

clip_image002  clip_image002[4]

 

Link to your custom code, don’t add it directly to the CEWP

For both 2007 and 2010 the best practice is to link from the CEWP to a text file with your content. To avoid the problem with the random edits made by 2010 just upload a text file containing the code to a library. Then in the CEWP just click the Edit Web Part option in the dropdown and add the link to the code file. This has added benefit of using any HTML, CSS and JavaScript editor such as Visual Studio or SharePoint Designer to edit your code.

 

Steps:

  1. Create your HTML, CSS and/or JavaScript in a text file, Notepad will do, and save it with any file extension.
    Tip: Name your file with a .HTM extension and then the SharePoint libraries will add a “Edit in SharePoint Designer” link in the file’s dropdown menu!
        image

    Notes: Your JavaScript should be enclosed in <script> tags and your CSS should be enclosed in <style> tags.

     
  2. After uploading to a library, right-click the file’s name and copy the shortcut
        image
  3. Go go your SharePoint and insert a Content Editor Web Part
    (2010 on the left, 2007 on the right)
        image clip_image002[9]
     
  4. Click the web part’s dropdown menu and click Edit
        image
     
  5. Paste the URL to the Notepad file in the Content Link box
         image
     
  6. Save your changes and test

    And if you have any errors, just open the HTM file in SharePoint Designer, make your changes and save, and then go back to the browser and click refresh!  Much faster than constantly editing and save the web part.

 

Hide the title area

If the CEWP only contains HTML, CSS and/or JavaScript then you may want to hide the web part’s title bar. In the properties editor, expand Appearance, click the Chrome Type dropdown and select None.

    clip_image002[5]

Tip: Don’t “hide” the web part. Just turn off its title bar.

 

.

2/01/2012

What do you call that? How do you capitalize this? The Microsoft Manual of Style

 

How do you…

If you write in the world of technology, whether blogs, books, training manuals, or even PowerPoint slides for your local user group, then you are often asking things like:

  • Is it “sub-folder” or “subfolder”?
  • What is that thing at the bottom of the screen called?
  • Is it an “Application Menu” or an “App Menu”?
  • Is it a “Status Bar” or a “status bar”

In the old days we would often refer to the Chicago Manual of Style for general writing guidelines, and over the years for Microsoft related writing, the Microsoft Manual of Style. The problem with the Microsoft manual is that is was getting quite dated, it was last updated in 2004, and in technology, that’s the dark ages!

The Microsoft Manual of Style as finally been updated, and what an update! I’ve only browsed though it picking up things here and there, and I’ve got to put it down and get back to work! They have included everything I need and even added coverage for Windows Phone. 437 pages of good stuff.

It’s not 100% complete as it does not have a product by product focus. SharePoint is not in the index! But, the book has to be light enough to carry, and there are other resources for products like SharePoint. (SharePoint glossary: http://msdn.microsoft.com/en-us/library/ie/ee556558.aspx)

 

There’s no excuse not to get it!

The paper back version is only $16.35 at Amazon and the Kindle version is only $9.95. You should get both… I’ve already dog-eared my paper copy and filled it with “stickies”, and I want the Kindle version to have with me everywhere I go. 

And, no you can’t borrow my copy!

(But I will bring it to the SharePoint User Group meeting Thursday night if you like to take a peek.)

 

 

Chapter 1: Microsoft style and voice

Chapter 2: Content for the web

Chapter 3: Content for a worldwide audience

Chapter 4: Accessible content

Chapter 5: The user interface

Chapter 6: Procedures and technical content

Chapter 7: Practical issues of style

Chapter 8: Grammar

Chapter 9: Punctuation

Chapter 10: Index and keywords

Chapter 11: Acronyms and other abbreviations

 

(and yes, they did their chapter titles with lower case words! I’ll have to look that one up too…)

 

.

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.