Author Archives: SP Quester - Page 2

Setting Permissions on a SharePoint List View

Have you ever stumbled on not being able to set permissions on a list in SharePoint?

Well, I received this requirement again last week, but this time I was able to find a workaround solution.

Requirement:

Build a simple time off report list for your organization. All regular employees will use the list to add and view their own time off report records. HR members should also have access to the list but should see everyone’s’ time off report.

Dilemma: the list is one; the permission levels for regular employees and HR members are different. So how do we configure different views and setup different permissions so that both entities (employees and HR member) can view what they are supposed to view?

Well, here is the workaround:

  1. Create the list. In my example above I called it Time Off Report.
  2. Set the right permissions on the list. In my example above, regular employees have contributor access and HR members has full access. These can be AD groups, SharePoint groups, or direct users.
  3. Create a web part page for HR members and set permissions for that page to be only accessed by HR, give them full access.
  4. Drop a web part on the web part page and bind it to your list. In my example Time Off Report list.
  5. Go back to the main list (“Time Off Report”) and change the default all items view to filter based on “created by”. The filter option is listed beneath the list of columns as part of the list view options. This way the default view for everyone is their own content.
    • Note: this step will prevent HR from viewing any records off the main list, which is okay since we are giving them their own page to view records from. Of couse, unless they will or have created their own time off report items.
  6. If needed, add links to both the default all items view and to the web part page for easier navigation and access by the different groups on to the top link bar.

Note: You have to configure it in the order shown, especially step 2 has to come before step 5.

The video below walks through the above example.

The video length is: 4:57

Calculating Totals and Rounding Percentages In InfoPath

Hey Folks,

This is more of a specific scenario I configured for a SharePoint team site where I have created the SharePoint list using InfoPath 2010.

The requirement was fairly simple; total up 17 numbers and provide and round up their percentage of 100. All my score fields get values from 1 to 5 where 5 is the best score (so a perfect score would be 17*5=85) and 1 is the worst score. I was able to perform the above with the following formula:

round((sum(Score 1) +   sum(Score 2) + sum(Score 3) + sum(Score 4) + sum(Score 5) + sum(Score 6) +   sum(Score 7) + sum(Score 8) + sum(Score 9) + sum(Score 10) + sum(Score 11) +   sum(Score 12) + sum(Score 13) + sum(Score 14) + sum(Score 15) + sum(Score 16)   + sum(Score 17)) * 100 / 85)

Here is the video that walks through the above:
Length: 5:26

 

 

Exploring SharePoint 2013 Themes

If you are like me then you’ll probably try out all SharePoint 2013 themes before you decide on one. But we all know how time consuming this exercise can be so I’ve taken the time to go through them and I’d like to share the look and feel with you so you don’t have to go through it.

The video below rotates through all SharePoint 2013 out of the box themes. There are 13 different themes and they are:

Office | Blossom | Breeze | City | Sea Monster | Nature |  Characters | Sketch | Orbit | Immerse | Wood | Green | Purple

Enjoy the 3:04 minute video!

Working With Site Collections And The Get Started Web Part in SharePoint 2013

There is nothing specific in this post about site collections per say. However, I just wanted to get a feel for how things are done in SharePoint 2013 and so I went ahead and created a site collection, played a bit with the getting started web part now part of the home page and navigated around. The video post below walks through some of that. Enjoy!

Video length: 6:03

Updating SharePoint Absolute URLs With Relative URLs Using Windows PowerShell

One of many common concerns during SharePoint upgrades are hard-coded or broken links.

When you create a list or a document library in SharePoint, you will notice that by default, the list or the document library link has been added to the Quick Launch on the left hand side of your site, Unless Quick Launch has been disabled. That kind of link upgrades with no issues since it is a relative link that SharePoint knows about and knows how to call and reference. However, when users, such as site owners, manipulate the Quick Launch navigation and add additional links, they manually type in the address and description, so that it is easier for their end users to access the link content, that link is what gets broken after an upgrade.

So the question of updating broken link is often a common one. Below we address this common concern to a certain extent. Obviously, hard coded links can be anywhere, on the links web part, inside of documents, on the top link bar, and on the native site Quick Launch.

Below is a script and a video that updates Quick Launch absolute links to relative URLs.

Note: You will have to upate the first four lines of the script your site scope, the quick launch heading, the absolute url you want to change, and the relative url you want to change to.

$site = “http://sharepoint2010/sites/SPQuester
$QuickLaunchHeading = “Libraries”
$absoluteUrl = “http://sharepoint2003/sites/SPQuester/Shared Documents”
$relativeUrl = “./Shared Documents” 
foreach ($web in (Get-SPSite  $site | Get-SPWeb -Limit All))
{
    $node = $web.Navigation.QuickLaunch | where { $_.Title -eq $QuickLaunchHeading }    foreach($childNode in $node.Children | where { $_.URL -eq ($absoluteUrl) })
    {
        Write-host “Updating” $childNode.Title “on the following site” $web.Url
        $childNode.URL = $relativeUrl
        $childNode.Update() 
    }
    $web.Update()
    $web.Dispose()
}
Write-host “Completed Successfully”

Video Length: 2:55

List Site Templates and IDs in SharePoint 2010 Using Windows PowerShell

One of the main checkpoints you will have to worry about as you upgrade or migrate SharePoint sites across farms or versions are custom site templates and how they are handled during migrations. You may upgrade or migrate custom site templates as is or you may elect to re-template site templates. A perfect place to start would be to know what custom site templates you have. So I did some research and finally stumbled upon a couple of scripts that I want to share with you. These scripts will help you:

  • List all site collections within a web application <– This will give us a better understanding of the total number of sites we may consider for migrations
Get-SPWebApplication “http://WebAppAddress“| Get-SPSite -limit ALL|Get-SPWeb -limit ALL|Select-Object Title,Url
  • List all site templates and template IDs for a given web application <– So we end up knowing what is standard and what is custom
$webapp = Get-SPWebApplication -identity http://WebAppAddress/
$webtem = Get-spwebtemplate
foreach ($site in $webapp.Sites)
{
 $spweb = get-spweb $site.URL
 write-host “Site URL: ” $site.URL
 write-host “Web Template: ” $spweb.WebTemplate
 write-host “WebTemplateID: ” $spweb.WebTemplateID
 write-host “————————————-”
}
  • List site template and site ID for a given site <– If there is a specific site we want to migrate and are interested in knowing what template it was created from
$web = Get-SPWeb http://webapp/sites/site/subsiteaddress
write-host “Web Template:” $web.WebTemplate ” | Web Template ID:” $web.WebTemplateId
$web.Dispose()
  • In general a list of all site templates available <– If you just want to see what site templates you have
 Get-SPWebTemplate | Sort-Object “Name”

I’ve recorded a short video to demonstrate the above.

Video length: 3:56

Ghazwan Khairi

SharePoint Quester

Using the Datasheet View to Bulk Update SharePoint 2010 List Columns

As I was digesting my SharePoint caffeine dose for the day, I came across a question that asked if there is a way to perform bulk updates on a SharePoint list column so I figured that is easy enough to record and share.

I know this can probably be done with PowerShell, but I used the Datasheet View along with the “Fill Down” action to demonstrate how that can be done. Enjoy!

Video length: 2:30

Ghazwan Khairi | a.k.a SharePoint Quester

Display Lists & Libraries That Use a Specific Content Type in SharePoint 2010

SharePoint content types encapsulate data requirements, enable content standardization, and are independent of file formats which makes them popular to use across SharePoint. Fast forward to a few hundred content types used within a large SharePoint environment and you’ll soon need to pay attention to managing these content types and answering question such as how many custom content types do we have and where are they being used.

A specific scenario this post addresses is the need to report on a specific content type use within a site collection. The video and script below highlight the process you’d need to take to generate such a report.

Video length: 2:24 min

To list a specific content type usage within a site collection copy and paste the following script into the SharePoint 2010 Management Shell.

Note: Two things to change: 1. The site collection address and 2. The content type name

 $webs = get-spsite http://sharepoint2010/sites/portal14| get-spwebforeach ($web in $webs)

foreach ($lst in $web.lists)  
{    
foreach ($ctype in $lst.ContentTypes)    
{      
if ($ctype.Name -eq “Document”)      
{ $lst.DefaultViewUrl
}   

}  
$web.Dispose()
}

 

List All Web Parts in a SharePoint 2010 Site Collection Using Windows PowerShell

I won’t make this overly complex, but if your organization is rapidly growing with SharePoint and you, farm admin, or your site collection administrators, or even your site owners are all super excited about SharePoint’s capabilities and you are provisioning sites or pages to justify the ever growing demands of your business, then you probably are adding hundreds of web parts to your sites and pages.

In most cases, these web parts are simply what shipped with the product and what gets placed on the sites once you provision them such as ‘Shared Documents’ or ‘Announcements’. In other cases, they maybe web parts developed in house by your development team to meet a specific demand such as ‘a moving average chard web part’ or even purchased from a third party vendor like Quest Software or Bamboo Solutions.

In any case, as your SharePoint succeeds and grows, and again, as you drop more web parts to your pages, the need to control and understand were these web parts are becomes super important. You will want to know which web parts are open and which ones are closed, which ones are used and which ones are not, which ones are affecting load time on pages and which ones are causing errors.

The video below captures the steps involved in executing a Windows PowerShell script that will loop through pages on publishing and non-publishing sites, finds all web parts, and outputs the result to a grid view.

Video length: 2:27

Use the below script to list all web parts in a site collection. The script loops through all pages, publishing and non-publishing sites, finds all web parts, and displays them on a grid view.

Note: Make sure you change the URL at the bottom of the script to your site collection URL.

 function enumerateWebParts($Url) {
    $site = new-object Microsoft.SharePoint.SPSite $Url    foreach($web in $site.AllWebs) {
        if ([Microsoft.SharePoint.Publishing.PublishingWeb]::IsPublishingWeb($web)) {
            $pWeb = [Microsoft.SharePoint.Publishing.PublishingWeb]::GetPublishingWeb($web)
            $pages = $pWeb.PagesList
            foreach ($item in $pages.Items) {
                $fileUrl = $webUrl + “/” + $item.File.Url
                $manager = $item.file.GetLimitedWebPartManager([System.Web.UI.WebControls.Webparts.PersonalizationScope]::Shared);
                $wps = $manager.webparts
                $wps | select-object @{Expression={$pWeb.Url};Label=”Web URL”},@{Expression={$fileUrl};Label=”Page URL”}, DisplayTitle, IsVisible, @{Expression={$_.GetType().ToString()};Label=”Type”}
            }
        }
        else {
            $pages = $null
            $pages = $web.Lists[“Site Pages”]            if ($pages) {                foreach ($item in $pages.Items) {
                    $fileUrl = $webUrl + “/” + $item.File.Url
                    $manager = $item.file.GetLimitedWebPartManager([System.Web.UI.WebControls.Webparts.PersonalizationScope]::Shared);
                    $wps = $manager.webparts
                    $wps | select-object @{Expression={$pWeb.Url};Label=”Web URL”},@{Expression={$fileUrl};Label=”Page URL”}, DisplayTitle, IsVisible, @{Expression={$_.GetType().ToString()};Label=”Type”}
                }
            }
            else {
            }
        }        Write-Host “… completed processing” $web
    }
}$row = enumerateWebParts(‘http://sharepoint2010/sites/spquester’)
$row | Out-GridView

If the Integrated Script Editor (ISE) is not installed, execute the following script then go back to the script above and execute it.

Import-Module ServerManagerAdd-WindowsFeature PowerShell-ISE