Wednesday, November 23, 2011
Parsing XML and databinding using jsRender and jsViews (RIP jQuery Templates)
jsRender Databinding SyntaxThe first line initializes the template object. The object is then rendered with the data and appended to an html element.
$("#tblTemplate").template("tblTemplate");
$("#tblBod").append($.render(obj, "tblTemplate"));
Saturday, September 17, 2011
Installing SharePoint 2010 on Windows 8
- Install SQL Server 2008. I used R2, but you can use any version listed in the requirements.
- Ensure all of the required IIS features are installed through Programs and Features. The easiest way to do this is to use the script that Microsoft provides. You can do this by copying the following into a Command Prompt.
Monday, June 6, 2011
Add every installed web part to a single SharePoint page
InstructionsThe first thing you’ll want to do is increase the maximum web parts per zone. The default is set to 50, but you can increase it by editing your web.config.
Friday, June 3, 2011
Create a favorites icon (favicon) for your SharePoint 2010 site
SPShortcut usage– This is hardcoded, so won’t work with feature deployments.
<SharePoint:SPShortcutIcon runat="server" IconUrl="/Style Library/Waffles/favicon.ico"/>
SPShortcut usage with $SPUrl – This will result in the following error: Unable to cast object of type 'System.String' to type 'System.Uri'.
<SharePoint:SPShortcutIcon runat="server" IconUrl="<% $SPUrl:~sitecollection/Style Library/Acme/favicon.ico %>" />
Solution
<asp:Literal runat="server" Text="<link rel='shortcut icon' href='" /><asp:Literal runat="server" Text="<% $SPUrl:~sitecollection/Style Library/Acme/favicon.ico %>" /><asp:Literal runat="server" Text="' type='image/vnd.microsoft.icon' />" />
Google.com’s favorite icon
SharePoint 2010, Favorites Icons (FavIcons) and SPUrl (SPUrlExpressionBuilder)Credit goes to Joel for this tip. Unfortunately, I could only get to his post via Google cache.http://joelblogs.co.uk/2010/11/09/sharepoint-2010-favorites-icons-favicons-and-spurl-spurlexpressionbuilder/
Wednesday, June 1, 2011
Get SharePoint audit details across the farm for specific users
Helpful Links
Configure audit settings for a site collectionshttp://office.microsoft.com/en-us/sharepoint-server-help/configure-audit-settings-for-a-site-collection-HA010099726.aspx
Custom Auditing in SharePoint
http://msdn.microsoft.com/en-us/magazine/cc794261.aspx
InstructionsCreate a c# Console Application in Visual Studio, add a reference to Microsoft.SharePoint, and then add the following code to Program.cs. This will work with SharePoint 2007 and 2010 as long as you reference the correct assembly. Don’t forget to make sure your Visual Studio project’s Platform Target is Any CPU or x64.
Wednesday, May 25, 2011
Determine auditing configuration details for all of your SharePoint site collections
InstructionsCreate a c# Console Application in Visual Studio, add a reference to Microsoft.SharePoint, and then add the following code to Program.cs. This will work with SharePoint 2007 and 2010 as long as you reference the correct assembly. Don’t forget to make sure your Visual Studio project’s Platform Target is Any CPU or x64.
Wednesday, April 13, 2011
Create Rounded Corners And Gradient Images On The Fly!
Enter the poorly named Web Designer Tool! After some experimentation with the System.Drawing and System.Drawing.Drawing2D .NET 2.0 classes, I figured out a way to generate these images on the fly. Now I can rapidly create rounded corners and gradients and don't have to sweat it if a client needs a color or hue adjusted. The rounded corners include many options, including width, height, gradient and solid colors, radius corner size, and border. I also provide a preview feature that integrates the images into a sample html page and launches it in your default browser. I have successfully tested this in IE 6.0 ~ 8.0, Chrome 10.0, and Firefox 4.0.
Note: Although this will fly in the face of CSS purists, I have decided to use a simple table based layout for the preview html. I do make an effort to use DIV based layouts for web design, but in this case I have yet to find approach that works flawlessly across browsers types and versions or that integrates nicely with SharePoint. If you are that CSS guru, I welcome you to take these images and come up with a better approach. If you are successful, I would love to try out your code. You are also welcome to use my Shapes.cs class below and build your own tool. Life will be much easier once CSS 3 has reached enough market penetration and we can simply use the border-radius property.
Friday, February 11, 2011
Custom Control with Connecting Lines using WPF / Silverlight
Recently I was developing a migration tool that incorporates two TreeView controls and allows a user to draw lines between controls. After a bit of a struggle, I finally came up with a solution that works pretty well. The control inherits from the Grid control and uses drag and drop event handlers to draw connecting lines between controls of the same type. Because it is a Grid control, it also gives you the ability to add multiple controls and style it as you wish. In this example, I simply embedded a border control with some rounded corners and line gradients. Within the Border control, I simply added a TextBlock with the necessary text. A random color algorithm (courtesy of Philosophil Blog) determines what color is used.
Custom Properties
ConnectedControl – When two controls are connected, they are able to reference each other through this property.
ConnectedLine – This contains a reference to the line that is added.
AllowMultipleConnections – This determines if the control to connect to multiple items.
ConnectionType – This is an enum that determines whether a control can connect to other controls based on their connection type. The values Both, Source, and Target. Both is the default and says that the control can connect to any other control. Source controls can only connect to Target controls and vice versa.
LineThickness – This determines how thick the connecting line is.
Steps
In order to use this control, you simply need to create a class called ConnectingControl.cs and copy and paste the code below your WPF project. (Of course, you will need to update your namespace.) In order to add the control to your page, simply add a reference to your local assembly and then add the control. At the very least, you will also need to nest another control like a TextBlock or Image. I have included the source code for my MainWindow.xaml below.
MainWindow.xaml
<Window x:Class="ConnectingLines.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:ConnectingLines"
Title="Connecting Lines" Height="350" Width="525">
<Window.Resources>
<Style x:Key="ConnectingGridBorderSource" TargetType="Border">
<Setter Property="Background" Value="{DynamicResource BoxBrushSource}" />
<Setter Property="CornerRadius" Value="0,35,0,35" />
<Setter Property="Margin" Value="0" />
</Style>
<Style x:Key="ConnectingGridBorderTarget" TargetType="Border">
<Setter Property="Background" Value="{DynamicResource BoxBrushTarget}" />
<Setter Property="CornerRadius" Value="0,35,0,35" />
<Setter Property="Margin" Value="0" />
</Style>
<Style x:Key="ConnectingGridSource" TargetType="local:ConnectingControl">
<Setter Property="Margin" Value="10" />
<Setter Property="AllowMultipleConnections" Value="False" />
<Setter Property="ConnectionType" Value="Source" />
<Setter Property="LineThickness" Value="3" />
</Style>
<Style x:Key="ConnectingGridTarget" TargetType="local:ConnectingControl">
<Setter Property="Margin" Value="10" />
<Setter Property="AllowMultipleConnections" Value="False" />
<Setter Property="ConnectionType" Value="Target" />
<Setter Property="LineThickness" Value="3" />
</Style>
<Style x:Key="ConnectingGridTextBlock" TargetType="TextBlock">
<Setter Property="Foreground" Value="AliceBlue" />
<Setter Property="FontSize" Value="24" />
<Setter Property="FontWeight" Value="Bold" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="HorizontalAlignment" Value="Center" />
</Style>
<LinearGradientBrush x:Key="BoxBrushSource" StartPoint="0,0" EndPoint="0,1">
<LinearGradientBrush.GradientStops>
<GradientStop Color="AliceBlue" Offset="0.0" />
<GradientStop Color="Green" Offset="0.4" />
</LinearGradientBrush.GradientStops>
</LinearGradientBrush>
<LinearGradientBrush x:Key="BoxBrushTarget" StartPoint="0,0" EndPoint="0,1">
<LinearGradientBrush.GradientStops>
<GradientStop Color="AliceBlue" Offset="0" />
<GradientStop Color="DarkBlue" Offset=".4" />
</LinearGradientBrush.GradientStops>
</LinearGradientBrush>
</Window.Resources>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<local:ConnectingControl Style="{StaticResource ConnectingGridSource}" Grid.Row="0" Grid.Column="0">
<Border Style="{StaticResource ConnectingGridBorderSource}">
<TextBlock Text="Banana" Style="{StaticResource ConnectingGridTextBlock}" />
</Border>
</local:ConnectingControl>
<local:ConnectingControl Style="{StaticResource ConnectingGridSource}" Grid.Row="1" Grid.Column="0">
<Border Style="{StaticResource ConnectingGridBorderSource}">
<TextBlock Text="Spinach" Style="{StaticResource ConnectingGridTextBlock}" />
</Border>
</local:ConnectingControl>
<local:ConnectingControl Style="{StaticResource ConnectingGridSource}" Grid.Row="2" Grid.Column="0">
<Border Style="{StaticResource ConnectingGridBorderSource}">
<TextBlock Text="Feta" Style="{StaticResource ConnectingGridTextBlock}" />
</Border>
</local:ConnectingControl>
<local:ConnectingControl Style="{StaticResource ConnectingGridTarget}" Grid.Row="0" Grid.Column="2">
<Border Style="{StaticResource ConnectingGridBorderTarget}">
<TextBlock Text="Cheese" Style="{StaticResource ConnectingGridTextBlock}" />
</Border>
</local:ConnectingControl>
<local:ConnectingControl Style="{StaticResource ConnectingGridTarget}" Grid.Row="1" Grid.Column="2">
<Border Style="{StaticResource ConnectingGridBorderTarget}">
<TextBlock Text="Fruit" Style="{StaticResource ConnectingGridTextBlock}" />
</Border>
</local:ConnectingControl>
<local:ConnectingControl Style="{StaticResource ConnectingGridTarget}" Grid.Row="2" Grid.Column="2">
<Border Style="{StaticResource ConnectingGridBorderTarget}">
<TextBlock Text="Vegetable" Style="{StaticResource ConnectingGridTextBlock}" />
</Border>
</local:ConnectingControl>
</Grid>
</Window>
ConnectingControl.cs
using System;
using System.ComponentModel;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Shapes;
namespace ConnectingLines
{
public class ConnectingControl : Grid
{
#region PROPERTIES
public enum Connection { Both, Source, Target };
private ConnectingControl ConnectedControl { get; set; }
private Line ConnectedLine { get; set; }
new private bool AllowDrop { get; set; }
#region DEPENDENCY PROPERTIES
public event PropertyChangedEventHandler PropertyChanged;
private void NotifyPropertyChanged(String info)
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(info));
}
}
public static readonly DependencyProperty AllowMultipleConnectionsProperty = DependencyProperty.Register("AllowMultipleConnections", typeof(bool), typeof(ConnectingControl));
public static readonly DependencyProperty ConnectionTypeProperty = DependencyProperty.Register("ConnectionType", typeof(Connection), typeof(ConnectingControl));
public static readonly DependencyProperty LineThicknessProperty = DependencyProperty.Register("LineThickness", typeof(double), typeof(ConnectingControl));
public bool AllowMultipleConnections
{
get
{
return (bool)GetValue(AllowMultipleConnectionsProperty); }
set
{
SetValue(AllowMultipleConnectionsProperty, value);
NotifyPropertyChanged("AllowMultipleConnections");
}
}
public Connection ConnectionType
{
get { return (Connection)GetValue(ConnectionTypeProperty); }
set
{
SetValue(ConnectionTypeProperty, value);
NotifyPropertyChanged("ConnectionType");
}
}
public double LineThickness
{
get
{
double thickness = (double)GetValue(LineThicknessProperty);
if (thickness == 0)
{
thickness = 3;
}
return thickness;
}
set
{
SetValue(LineThicknessProperty, value);
NotifyPropertyChanged("LineThickness");
}
}
#endregion
#endregion
#region CONSTRUCTOR AND INITIALIZER
public ConnectingControl()
{
this.DragEnter += new DragEventHandler(CustomButton_DragEnter);
this.Drop += new DragEventHandler(CustomButton_Drop);
this.PreviewMouseLeftButtonDown += new MouseButtonEventHandler(CustomButton_PreviewMouseLeftButtonDown);
}
protected override void OnInitialized(System.EventArgs e)
{
base.AllowDrop = true;
base.OnInitialized(e);
PreviewMouseLeftButtonDown += new MouseButtonEventHandler(CustomButton_PreviewMouseLeftButtonDown);
Drop += new System.Windows.DragEventHandler(CustomButton_Drop);
DragEnter += new System.Windows.DragEventHandler(CustomButton_DragEnter);
}
#endregion
#region EVENT HANDLERS AND METHODS
protected void CustomButton_PreviewMouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
ConnectingControl item = (ConnectingControl)sender;
DataObject dragData = new DataObject("source", (ConnectingControl)sender);
DragDrop.DoDragDrop((ConnectingControl)sender, dragData, DragDropEffects.Move);
}
protected void CustomButton_DragEnter(object sender, System.Windows.DragEventArgs e)
{
if (!e.Data.GetDataPresent("source") || sender == e.Source)
{
e.Effects = DragDropEffects.None;
}
}
protected void CustomButton_Drop(object sender, System.Windows.DragEventArgs e)
{
if (e.Data.GetDataPresent("source"))
{
ConnectingControl source = e.Data.GetData("source") as ConnectingControl;
ConnectedControl = source;
ConnectControls();
}
}
private void ConnectControls()
{
bool connect = false;
if (this.ConnectionType == Connection.Both)
{
connect = true;
}
else
{
if (this.ConnectionType == ConnectedControl.ConnectionType)
{
connect = false;
}
else
{
connect = true;
}
}
if (connect)
{
Panel parent = GetRoot(this);
Line line = new Line() { StrokeThickness = LineThickness, Stroke = GetRandomBrush() };
GeneralTransform sourceTransform = ConnectedControl.TransformToVisual(parent);
Point sourcePoint = sourceTransform.Transform(new Point(0, 0));
GeneralTransform targetTransform = this.TransformToVisual(parent);
Point targetPoint = targetTransform.Transform(new Point(0, 0));
if (sourcePoint.X < targetPoint.X)
{
line.X1 = sourcePoint.X + ConnectedControl.ActualWidth;
line.Y1 = sourcePoint.Y + ConnectedControl.ActualHeight / 2;
line.X2 = targetPoint.X;
line.Y2 = targetPoint.Y + this.ActualHeight / 2;
}
else
{
line.X1 = targetPoint.X + this.ActualWidth;
line.Y1 = targetPoint.Y + this.ActualHeight / 2;
line.X2 = sourcePoint.X;
line.Y2 = sourcePoint.Y + ConnectedControl.ActualHeight / 2;
}
if (parent.GetType() == typeof(Grid))
{
line.SetValue(Grid.ColumnSpanProperty, ((Grid)parent).ColumnDefinitions.Count);
line.SetValue(Grid.RowSpanProperty, ((Grid)parent).RowDefinitions.Count);
}
if (!AllowMultipleConnections)
{
if (ConnectedLine != null)
{
parent.Children.Remove(ConnectedLine);
}
if (ConnectedControl != null)
{
if (ConnectedControl.ConnectedLine != null)
{
GetRoot(this).Children.Remove(ConnectedControl.ConnectedLine);
}
}
}
ConnectedLine = line;
ConnectedControl.ConnectedLine = line;
parent.Children.Add(line);
}
}
#endregion
#region MISC METHODS
private Panel GetRoot(FrameworkElement child)
{
var parent = child.Parent as FrameworkElement;
if (parent == null)
{
if (child is Window)
{
if (((Window)child).Content.GetType().BaseType == typeof(Panel))
{
return ((Window)child).Content as Panel;
}
else
{
throw new Exception("The root content element is an unexpected type. It should be a Panel instead of a " +
((Window)child).Content.GetType().BaseType.ToString() + ".");
}
}
else
{
throw new Exception("The root element is an unexpected type. It should be a Window instead of a" +
child.GetType().ToString() + ".");
}
}
return GetRoot(parent);
}
//COLOR GENERATOR CODE Courtesy of: http://philosophil.spaces.live.com/blog/cns!7E55D8EFA2AEE5D6!201.entry
private Brush GetRandomBrush()
{
Random randomColor = new Random();
SolidColorBrush brush = new SolidColorBrush();
double r, g, b;
double lightness = randomColor.NextDouble() * 0.5 + 0.4; // not too dark nor too light
double hue = randomColor.NextDouble() * 360.0; // full hue spectrum
double saturation = randomColor.NextDouble() * 0.8 + 0.2; // not too grayish
HSLtoRGB(hue, saturation, lightness, out r, out g, out b);
brush.Color = System.Windows.Media.Color.FromRgb((byte)(r * 255.0), (byte)(g * 255.0), (byte)(b * 255.0));
return brush;
}
public static void HSLtoRGB(double hue, double saturation, double luminance, out double red, out double green, out double blue)
{
double q;
double p;
if (luminance < 0.5)
{
q = luminance * (1.0 + saturation);
}
else
{
q = luminance + saturation - (luminance * saturation);
}
p = 2 * luminance - q;
double hk = hue / 360.0;
double tr = hk + 1.0 / 3.0;
double tg = hk;
double tb = hk - 1.0 / 3.0;
tr = Normalize(tr);
tg = Normalize(tg);
tb = Normalize(tb);
red = ComputeColor(q, p, tr);
green = ComputeColor(q, p, tg);
blue = ComputeColor(q, p, tb);
}
private static double ComputeColor(double q, double p, double tc)
{
if (tc < 1.0 / 6.0)
{
return p + ((q - p) * 6.0 * tc);
}
if (tc < 0.5)
{
return q;
}
if (tc < 2.0 / 3.0)
{
return p + ((q - p) * 6.0 * (2.0 / 3.0 - tc));
}
return p;
}
private static double Normalize(double tr)
{
if (tr < 0)
{
return tr + 1.0;
}
if (tr > 1.0)
{
return tr - 1.0;
}
return tr;
}
#endregion
}
}
A simple WPF fading popup control
Steps:
1.) Create a WPF Project in Visual Studio. I named mine FadingPopup. (Note: You can use 3.5 or 4.0, but you will need to use 4.0 if you want to take advantage of the animation EasingFunctions.)
2.) Add a User Control with the following code:
FadingPopupControl.xaml
<UserControl x:Class="FadingPopup.FadingPopupControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d" BorderThickness="0" Margin="0">
<UserControl.Resources>
<Storyboard x:Name="StatusFader" x:Key="StatusFader" Completed="StatusFader_Completed">
<DoubleAnimation Storyboard.TargetName="popupBackground" Storyboard.TargetProperty="Opacity" From="0.7" To="0" BeginTime="0:0:0" Duration="0:0:1.5">
<DoubleAnimation.EasingFunction>
<ExponentialEase Exponent="10" EasingMode="EaseIn" />
</DoubleAnimation.EasingFunction>
</DoubleAnimation>
</Storyboard>
</UserControl.Resources>
<Popup Name="popup" Placement="Center" PopupAnimation="Fade" AllowsTransparency="True">
<Grid Background="Transparent">
<Grid Name="popupBackground" Background="Black" Grid.Column="0" Grid.Row="0" />
<Label Name="popupLabel" DockPanel.Dock="Bottom" HorizontalAlignment="Center" Foreground="White" VerticalAlignment="Center" Background="Transparent" Grid.Column="0" Grid.Row="0"/>
</Grid>
</Popup>
</UserControl>
FadingPopupControl.xaml.cs
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media.Animation;
namespace FadingPopup
{
public partial class FadingPopupControl : UserControl
{
Window ParentWindow { get; set; }
public FadingPopupControl()
{
InitializeComponent();
}
protected override void OnInitialized(EventArgs e)
{
base.OnInitialized(e);
}
public void ShowDialogBox(Window parentWindow, string message)
{
ParentWindow = parentWindow;
popupLabel.Content = message;
Storyboard StatusFader = (Storyboard)Resources["StatusFader"];
ParentWindow.IsEnabled = false;
FrameworkElement root = (FrameworkElement)ParentWindow.Content;
this.Height = root.ActualHeight;
this.Width = root.ActualWidth;
//TODO: Determine why there is 1 pixel extra whitespace.
//Tried playing with Margins and Alignment to no avail.
popup.Height = root.ActualHeight + 1;
popup.Width = root.ActualWidth + 1;
popup.IsOpen = true;
StatusFader.Begin(popupBackground);
}
void StatusFader_Completed(object sender, EventArgs e)
{
popup.IsOpen = false;
ParentWindow.IsEnabled = true;
}
}
}
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media.Animation;
namespace FadingPopup
{
public partial class FadingPopupControl : UserControl
{
Window ParentWindow { get; set; }
public FadingPopupControl()
{
InitializeComponent();
}
protected override void OnInitialized(EventArgs e)
{
base.OnInitialized(e);
}
public void ShowDialogBox(Window parentWindow, string message)
{
ParentWindow = parentWindow;
popupLabel.Content = message;
Storyboard StatusFader = (Storyboard)Resources["StatusFader"];
ParentWindow.IsEnabled = false;
FrameworkElement root = (FrameworkElement)ParentWindow.Content;
this.Height = root.ActualHeight;
this.Width = root.ActualWidth;
//TODO: Determine why there is 1 pixel extra whitespace.
//Tried playing with Margins and Alignment to no avail.
popup.Height = root.ActualHeight + 1;
popup.Width = root.ActualWidth + 1;
popup.IsOpen = true;
StatusFader.Begin(popupBackground);
}
void StatusFader_Completed(object sender, EventArgs e)
{
popup.IsOpen = false;
ParentWindow.IsEnabled = true;
}
}
}
3.) In the MainWindow.xaml, add a Button with a PreviewMouseLeftButtonDown event handler.
4.) Add a local reference and then your popup control.
5.) In your button event handler, initiate the popup.
MainWindow.xaml
<Window x:Class="FadingPopup.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:FadingPopup"
xmlns:controls="clr-namespace:System.Windows.Controls;assembly=PresentationFramework"
Title="MainWindow" Height="350" Width="525">
<Grid>
<Button x:Name="Test1" Height="40" Width="80" Content="Test1" Grid.Column="0" AllowDrop="False" PreviewMouseLeftButtonDown="Test1_PreviewMouseLeftButtonDown" />
<local:FadingPopupControl x:Name="popup" />
</Grid>
</Window>
MainWindow.xaml.cs
using System.Windows;
using System.Windows.Input;
namespace FadingPopup
{
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
private void Test1_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
popup.ShowDialogBox(Test1, "The is a sample message...");
}
}
}
Screenshots
This fades out in 1.2 seconds
Tuesday, February 1, 2011
PowerShell for SharePoint on Steroids!
This script includes the following functions:
- Creating Web Application
- Creating Site Collections
- Creating Subsites
- Setting Master Pages recursively.
- Adding Features
- Adding Site Columns
- Creating Lists
- Adding folders to Lists
- Adding Site Column to Lists
- Creating Views
- Enabling/Disabling Publishing, Checkin, and Approvals
- Creating Sample Items for Links, Announcements, and Calendar lists with permissions.
- Creating Publishing Pages
- Creating Groups with default owners
- Set Group permissions for subsites
- Add Content Query Web Parts (CQWP) for site and subsite lists.
Tools
It it is free and has a great interface and provides things like debugging, Intellisense, formatting,
and plug-ins. Power GUI: http://www.powergui.org
Developer Notes: I am not a PowerShell pro by any stretch of imagination and am still learning the intricacies of the language. There is no use of classes, collections, and exception handling is sparse. Some of this is due to my ignorance on the subject. That being said, I have no doubt there are areas that can be written more efficiently.
CreateSamplePublishingPortal Function
Description
Parameters
$createWebApplication - Boolean to determine if Web Application is created.
$createSiteCollection - Boolean to determine if Site Collection is created.
$env - Determines the environment. Valid values are: "dev", "qa", or "prod".
Variables within the function must be updated to use this functionality.
Global Variables
to ensure they will work with your environment. You can also comment out parts of the script that you don't want to run.
Lists
"Private Team", "Public Team", and "Intranet".
- Corresponding views are created for each "Site Visibility" value.
- A "public" folder added to each list and read permissions added to allow users outside of the private site.
- Sample items are also added to the lists and every combination of "Site Visibility" is used. If the
value for the item has a "Site Visibility" that contains "Public Team" or "Intranet" it is moved into the "public" folder.
This allows permissions to stay at the folder level and not the item level.
- Note: A workflow still needs to be created to ensure that when items are created or changed they go to the public folder.
Permissions
Group Name Permission
HR Owners Full Control
HR Members Contribue
HR Visitors Read
The script also applies a default owner for all groups. This is an array variable that can be updated before running the script.
Aggregate Views
Execution Time
Site Hierarchy
Intranet (Web Application)
Intranet Site Collection *(See notes below)
Departments (Publishing Site)
Private (Publishing Site)
Finance (Publishing Site)
Announcements (Announcements List)
News (News List)
I Want To (Links List)
Staff Roles (Publishing Page)
Training (Publishing Page)
New Hires (Publishing Page)
Human Resources (Publishing Site)
News (News List)
I Want To (Links List)
Staff Roles (Publishing Page)
Training (Publishing Page)
Information Technology Publishing Site
News (News List)
I Want To (Links List)
Staff Roles (Publishing Page)
Training (Publishing Page)
New Hires (Publishing Page)
News (News List)
I Want To (Links List)
Staff Roles (Publishing Page)
Training (Publishing Page)
New Hires (Publishing Page)
Information Technology (Publishing Site) **(See notes below)
Marketing (Publishing Site) **(See notes below)
* Intranet Home page includes CQWPs that point to Lists from all departmental Private departmental sites. These are filtered by "Site Visibility" column where the value contains "Intranet".
** TODO: Departmental Public Home page includes CQWPs that aggregate Lists from corresponding Private departmental site.
These are filtered by "Site Visibility" column where the value contains "Public Team".