Monday, 9 August 2010

Find GUID of a site column in SharePoint using PowerShell

Whilst a simple script, this illustrates the real advantages of PowerShell. I needed to find the ID’s of some site columns I had created in SharePoint 2010. In the days of MOSS 2007, I would have had to either work out the GUID from looking at the URL of the column in the browser or write a custom application in Visual Studio to get the information I needed by accessing the Object Model. Now, I spend a minute writing a script in PowerShell and it’s reusable time and time again.

The script asks the user to input the display name of the site column and then gets the name and GUID of the column and outputs it to the console. I have configured the URL as a variable, but you could also ask the user for this if you wanted to:

$web = Get-SPWeb http://portal
$columnName = Read-Host "Enter the column title (display name)"
write-host $web.Fields[$columnName].Title -nonewline
write-host " "$web.Fields[$columnName].Id -foregroundcolor Red
$web.Dispose()

You could use the essence of this script to find a whole bunch of information about the column, if required. A full list of properties can be found on MSDN here.

14 comments:

  1. $web = Get-SPWeb http://sp2010dev
    foreach ($field in $web.Fields)
    {
    write-output "Title: $($field.Title) | ID: $($field.Id)"
    }
    $web.Dispose()

    Save it to a file. Then run with something like ./fields.ps1 out-File fields.txt

    Just creates a text file with all the site columns and ids.

    Thanks for posting!

    ReplyDelete
  2. sorry... just make sure you swap http://sp2010dev for the appropriate AAM.

    ReplyDelete
  3. Brilliant. Just what I was looking for. Thanks guys.

    ReplyDelete
  4. “Estée used to say, ‘Wear one great piece,’” designer Aerin Lauder tells Threads, referring to her makeup-maven grandmother. “She always said, ‘Less is more.’ If you look at pictures of her, she’s in a red dress, with an amazing David Webb necklace and an amazing clutch. And she was always in high Michael Kors Handbags heels.” That advice is paying off, as the younger Lauder expands her luxe home-goods line (that $285 coaster set has got us like whoa) to include chic shoes, scarves and purses.“I have one of my grandmother’s purses in the office for inspiration,” she says. “Every time I open one of her bags, michael kors bags it makes me smile because there’s one of her handkerchiefs or mirrors or compacts.” Her other muse? Socialite-turned-stylista Olivia Palermo, whom Lauder tapped to model for the new accessories campaign. “When we met with her, she was wearing a pale-pink ribbon around her neck, which is the color of our beauty line,” michael kors outlet online says Lauder. “It’s very important to pick someone who represents you and has your sense of style.” Something tells us Grandma Lauder would approve.
    Indeed, all the clothes she wore on the campaign trail seem to have been part of a shopping spree, as opposed to a strategic plan. There’s nothing wrong coach outlet with that. Arguably it is part of what makes a woman who lives in a gilded penthouse seem more normal (she buys, just like everyone else!) But it reflects her distance from the industry.And it is striking that while Ralph Lauren is an American brand, which may indicate a decision to support michael kors outlet online homegrown talent and promote local industry, Mrs. Trump has also worn Fendi (Italian), Roksanda Ilincic (British) and Emilia Wickstead (British) on the campaign trail. When she went to cast her vote, Mrs. Trump threw a gold-buttoned camel Balmain military coat (French) over her shoulders.Neither her wardrobe nor that of the rest of Longchamp Outlet the family has been used in the traditional way (see: Jackie Kennedy and Nancy Reagan), to telegraph the virtues of Made in America — though that has been one of Mr. Trump’s most vociferously promoted platforms.Mr. Trump himself has stuck closely to his uniform of Brioni suits and made-in-China fire engine red coach factory outlet ties from his own brand. His daughter and public surrogate, Ivanka, has worn an assortment of styles and high-fashion names, including her own label, the Roland Mouret asymmetric top she wore to the third debate, and the Alexander McQueen dress she sported at her father’s acceptance speech, though they can all be michael kors outlet clearance pretty broadly categorized as “power sheath.”
    These models are real knockouts.A stunning blond catwalker got into a drag-out brawl with her gorgeous roommate, also a model,

    ReplyDelete