Random header image... Refresh for more!

Posts Tagged ‘Sharepoint’

MOSS 2007 Script Collection

Icon Written by Niklas Goude on September 8, 2009 – 5:54 pm

I’ve been working with SharePoint and PowerShell for quite some time now and I would like to share a couple of Scripts that I use when scripting MOSS. Actually, it’s 44 Scripts, Loads of Coffee and alot of long nights so I hope you enjoy them. There are Links at the bottom of [...]

Tags: ,

SharePoint and PowerShell – In real life

Icon Written by Niklas Goude on March 15, 2009 – 8:44 pm

I’ve had PowerShell.nu for quite some time now, gathering information and writing posts on various ways of solving issues through PowerShell, tips and trix and How too’s that have been both fun and educational for me and hopefully for the people reading my blog.

I think it’s a journey worth taking, not just for the fun [...]

Tags: ,

Create site with approval workflow using PowerShell Part 2

Icon Written by Niklas Goude on March 9, 2009 – 10:52 pm

This is the fourth Cross Blog post that I’ve made with Mattias and they are getting better and better.

Now, we are heading onto MOSS and the SiteDirectory. Scripting the SiteDirectory is basically the same as scripting a list with items. The fun part is checking the “Approved” value set by an administrator or by someone [...]

Tags:

Set-Theme.ps1, Set Theme in Sharepoint using PowerShell

Icon Written by Niklas Goude on March 8, 2009 – 9:45 pm

I wrote a blog post about this a couple of months ago, so here’s an updated script version that let’s you change theme on your SharePoint sites. It’s pretty straight forward and it includes a help function that explains how to use the Script.

Let’s say you have a site http://wss/Teams/TeamWiki. You get a request from [...]

Tags:

Export a list with all the sites in a site collection part 2

Icon Written by Niklas Goude on February 23, 2009 – 9:31 pm

This is a follow-up on Part 1 by Mattias Karlssons

As Mattias mentioned, generating a list with Site information is a feature that many people ask for. It’s possible to get the information from the Site Hierarchy or the Site Content and Structure, as Mattias shows in his post

I’m going to show you how to retrieve [...]

Tags:

Remove Sharepoint Users Programmatically Part 2

Icon Written by Niklas Goude on February 16, 2009 – 7:45 pm

Mattias Described the Scenario in part 1 of this post

Following up on his blog post, I’m going to descrbibe how to script this through SharePoint.

Starting off, we connect to the Site that we believe the User Object is in. Then we create a simple If Else statement that checks if the User Exists, and If [...]

Tags:

Batch Creation of Sharepoint Sites Part 2

Icon Written by Niklas Goude on February 9, 2009 – 9:03 pm

This is the second part of a Post started by Mattias Karlsson. Click Here to See Part One

Following on Mattias lead, I’m going to describe how to build a script that automates
the creation of 700+ Sites in sharepoint.

The scenario is well described by Mattias so I’m just going to dig directly into the code.

The first [...]

Tags:

Hiding a ListField in NewForm/EditForm in Sharepoint

Icon Written by Niklas Goude on January 13, 2009 – 9:49 pm

Hiding a Field can be useful if you don’t want your Users to be able to edit a specific field. Mattias Karlsson, a friend of mine, describes a step-by-step on achieving this on his blog. In this Post, I’m going to describe how to do it through PowerShell. First make a connection to the specific [...]

Tags:

Add Site to TopNavigationBar in Sharepoint

Icon Written by Niklas Goude on January 8, 2009 – 4:20 pm

When Adding a site to the TopNavigationBar, we need to create a New-Object using Navigation.SPNavigationNode. Here’s an example on adding a site to the TopNavigationBar. This is basically the same as when adding the Site to the QuickLaunch.

function Add-SPSiteToTopNav([string]$url,[string]$Site,[string]$SiteURL) {

[System.Reflection.Assembly]::LoadWithPartialName(“Microsoft.SharePoint”)

$SPSite = New-Object Microsoft.SharePoint.SPSite($url)
$OpenWeb = $SpSite.OpenWeb()

$TopNavBar = [...]

Tags:

Add Site to QuickLaunch in Sharepoint

Icon Written by Niklas Goude on January 8, 2009 – 3:16 pm

When Adding a site to the QuickLaunch, we need to create a New-Object using Navigation.SPNavigationNode. Here’s an example on adding a site to the QuickLaunch.

function Add-SPSiteToQuickLaunch([string]$url, [string]$Site, [string]$SiteURL) {

[System.Reflection.Assembly]::LoadWithPartialName(“Microsoft.SharePoint”)

$SPSite = New-Object Microsoft.SharePoint.SPSite($url)
$OpenWeb = $SpSite.OpenWeb()

$QuickLaunch = $OpenWeb.Navigation.QuickLaunch
$Node = New-Object Microsoft.SharePoint.Navigation.SPNavigationNode $Site, $SiteURL, 1
$QuickLaunch.AddAsLast($node)

[...]

Tags:

Create a new Site in Sharepoint

Icon Written by Niklas Goude on January 8, 2009 – 2:54 pm

Adding new sites to our Portal is our next step. We do this using the add() method on AllWebs.
Note that there are a couple of values that we have to consider.
First three values are strings, staring with url, title and then description. next, we got the site language.
Then theres site template. Here you can use [...]

Tags:

Add Items to a List in Sharepoint

Icon Written by Niklas Goude on January 8, 2009 – 10:02 am

Our List contains a couple of different Fields: User,Text,Choice,Lookup and the default Title Field. Let’s start preparing the information that we want to add into our item.

The Title Field requires a Text String, so I’m going to set up a variable containing a TextString.

PS > $Title = “Item Title”

When preparing the UserField, we need to [...]

Tags:

Adding Fields to a List in Sharepoint

Icon Written by Niklas Goude on January 6, 2009 – 10:56 pm

There are a couple of types that you can add to a list, Single Line of Text, Multiple Lines o Text, Users etc. Here’s how to get a complete list of all available list types:

PS > [System.Reflection.Assembly]::LoadWithPartialName(“Microsoft.SharePoint”)

PS > $SPSite = New-Object Microsoft.SharePoint.SPSite(“http://wss”); $OpenWeb = $SpSite.OpenWeb(); $OpenWeb.FieldTypeDefinitionCollection | Select TypeName; $OpenWeb.Dispose(); $SPSite.Dispose()

TypeName
——–
Counter
Text
Note
Choice
MultiChoice
GridChoice
Integer
Number
ModStat
Currency
DateTime
Lookup
Boolean
Threading
ThreadIndex
Guid
Computed
File
Attachments
User
URL
Calculated
Recurrence
CrossProjectLink
ContentTypeId
MultiColumn
LookupMulti
UserMulti
WorkflowStatus
AllDayEvent
WorkflowEventType
PageSeparator

Let’s Add a couple of [...]

Tags:

Adding Lists to the QuickLaunch in Sharepoint

Icon Written by Niklas Goude on January 6, 2009 – 10:37 pm

By default, the lists that we create through PowerShell are not in the quicklaunch, so we have to tell SharePoint that we want it there. The OnQuickLaunch value is set to $false so changing this to $true will add our Custom List to the Quicklaunch. We also need to allow ContentTypes in order to add [...]

Tags:

Creating A Custom List in Sharepoint

Icon Written by Niklas Goude on January 6, 2009 – 10:08 pm

Okay, so now we’ve got our users and groups in place. Let’s start extending the Site a little. Starting off, let’s look at Custom Lists. Custom Lists are like excel sheets where we can store information in columns. There are lots of different types of data that we can store, such as: Single line of [...]

Tags:

Adding User to Group in Sharepoint

Icon Written by Niklas Goude on January 6, 2009 – 9:58 pm

Adding Users to a specified group in Sharepoint can be done through the AddUser method on a specific group.

First we have to create a variable around the group that we want to work with, in this example we will use the group that was created in the Adding a Custom Group to Sharepoint post.

PS > [...]

Tags:

Adding Users to Sharepoint

Icon Written by Niklas Goude on January 6, 2009 – 3:52 pm

Adding Users from Active-Directory into Sharepoint is done in 2 steps. First we will need to Get the information required from Active-Directory and then we need to Add the informtaion into Sharepoint.
Lets start with Active-Directory. Below is an image of the Active-Directory Design in this example:

Since we want to Get the User information we need [...]

Tags: ,

Adding A Custom Group to Sharepoint

Icon Written by Niklas Goude on January 6, 2009 – 2:35 pm

SharePoint has a couple of default groups but say we want to create our own group. The values that we need to assign are:

String name
SPMember owner
SPUser defaultUser
String description

Name and description are strings. SPMemeber Owner and SPMember defaultUser are a little tricky.. You have to retrieve these from existing Users in SharePoint. In this example [...]

Tags:

Changing Theme in Sharepoint

Icon Written by Niklas Goude on January 6, 2009 – 2:04 pm

Changing the theme of a Sharepoint site is an easy task through PowerShell. there are a couple of available themes that you can choose from.
You can use the following themes in WSS 3.0
Beltown
Breeze
Cardinal
Citrus
Claasic
Default Theme
Granite
Jet
Lacquer
Lichen
Obsidian
Petal
Plastic
Reflector
Simple
Verdant
Vintage
Weat
To change Theme, we can use the ApplyTheme() method. Before we use the method we define which site we want to change [...]

Tags:

Connecting To Sharepoint

Icon Written by Niklas Goude on January 5, 2009 – 11:25 pm

The first time i came in contact with PowerShell was when i started working with SharePoint Services 3.0 Since WSS 3.0 has great .NET support, it felt like the obvious approach to manage WSS 3.0 through PowerShell.
There are two great sites on the internet that contain loads of information on PowerShell and SharePoint. First we [...]

Tags: