Skip to main content

Blog

Go Search
Consulting and Software Development for the Microsoft Platform
Blog
  

Categories
SharePoint
Other Blogs
There are no items in this list.
Consulting and Software Development for the Microsoft Platform > Blog
Augmenting SharePoint Quick Launch for Security Trimming

Well you probably found this blog entry because you found out, like I did, that manually created Quick Launch links do not provide security trimming.  This of course is undesirable in many cases as your users will get the “Access Denied” page or be prompted for their credentials when they click a link they shouldn’t see in the first place.  Typically you’d like SharePoint to remove the link from the Quick Launch so the user doesn’t even see it like the automatically added links do. 

Solution:

One way to work around this issue is to add a Links list.  Then add the links that would normally be on the Quick Launch.  Set the permissions on the individual link items based on the permissions you need.  This means that users will only see the link items that they have permissions to.  Next modify your master page to include a Web Part Zone underneath the Quick Launch.  On your pages, add a Data View Web Part that displays the Link list items.  I added an additional field to specify whether or not the link is to be opened in a new browser window or not.

This is a pretty simple way to get around one of SharePoint’s more annoying issues.

Creating SPFieldChoice Columns using PowerShell

It has been too long that I've been sucking the knowledge off of everyone else and not posting my own discoveries for others to benefit from. So here goes.

One of my clients has about 40 choice fields for one of their lists and rather than creating a feature I decided to just use PowerShell to add the fields to the list. I need to review the out of the box form with the client and rather than spend the time to build the feature, I'm building the list in my development environment so I can review it with them before I spend the time to build it.

The one key thing I found is that it only worked if I did the following (which isn't completely obvious)

  • Create the field
  • the field to the list
  • Updated the list
  • Retrieve the field from the list
  • Add the choices for the SPFieldChoice field type and any other properties like the default value
  • Update the field
  • Update the list

Here's the PowerShell script. I've not done this from a .NET console app but I'd be interested if it behaves the same.

[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")
function AddField
{ param ([Microsoft.SharePoint.SPList]$spList, [string]$fieldName)
$spField = new-object Microsoft.SharePoint.SPFieldChoice($spList.Fields,"Choice", $fieldName)
$spList.Fields.Add($spField)
$spList.Update()
$spField = $spList.Fields[$fieldName]
$spField.Choices.Add("No")
$spField.Choices.Add("Yes")
$spField.Choices.Add("Preferred")
$spField.DefaultValue = "No"
$spField.Update()
$spList.Update()
}
$siteUrl = "http://site"
$spSite = new-object Microsoft.SharePoint.SPSite($siteurl)
$spWeb = $spSite.OpenWeb($webName)
$listName = "Vendors"
$spList = $spWeb.Lists[$listName]
AddField -spList $spList -fieldName "Antenna Repair"

You Can Do It.  Complete Corporate Intranet using Windows SharePoint Services 3.0 & Microsoft Search Server Express 2008
Recently I completed a corporate intranet using Windows SharePoint Services (WSS) and Microsoft Search Server Express 2008 (MSSSE). Here are some things that I unexpectedly ran in to. I'll explain how I got around them in future blogs.
  • No fly-out or sub-menus in WSS - Unlike MOSS the out of the box (OTB) Top Link capabilities of WSS are limited and do not support sub-menus.
  • No support for using SQL data for lookup fields - Unlike MOSS WSS doesn't have Business Data Catalog functionality to integrate with other systems like SQL Server. Note: SharePoint 2010 version of WSS will have this capability.
  • WSS doesn't support cascading master pages for sub-sites through the OTB user interface.
  • You cannot add custom layout pages to the "Add New Web Part" page.
  • The OTB Web Part Page layouts do not include the Quick Launch navigation element.
  • You cannot add "embed" codes, such as links to Flash videos etc, in to Rich Text Box fields.
  • Using "=[me]" calculated default value returns the user name prefixed by domain or membership provider name and not the users name.
  • There is no "printer friendly" view for things like Wiki pages.
Stay tuned as I blog about how to overcome these gotchas.

 ‭(Hidden)‬ Admin Links