Tuesday, November 1, 2016

SharePoint List all publishing pages and their associated page layout

ve often been asked to get almost any kind of report about SharePoint’s content. This time the customer asked me to get the list of all publishing pages and their page layout in a site collection. This is quite an easy task, of course using PowerShell! It’s just a matter of looping through all SPWebs in the site collections, get the page library content and print some item properties in a text file. Let’s see how to do that.
Since this is just a quick tip take a look to the comments in the script, they should be self explaining :)
if ((gsnp Microsoft.SharePoint.Powershell -ErrorAction SilentlyContinue) -eq $null){
    asnp Microsoft.SharePoint.Powershell -ErrorAction Stop
}

$site = Get-SPSite http://intranet
$log = "C:\temp\PageLayouts.csv"

## Check if log file exists and clear its content

if ((Test-Path -Path $log -ea SilentlyContinue) -ne $null){

    clc $log
    ac $log "Page URL, Page Title, Page Layout URL, Page Layout Title"

}

## loop through all webs in the site collection

$site | Get-SPWeb -Limit All | %{
   
    $web = $_

    ## Get the page library and items

    $pl = $web.Lists["Pages"]

    $pages = $pl.Items

    foreach ($page in $pages){

        ## add content to the log file
       
        ac $log "$($web.url)/$($page.Url), $($page.Title), $($page.Properties["PublishingPageLayout"])"

    }

}

$site.Dispose()

Friday, June 17, 2016

Configure Friendly URL in SharePoint 2013


Term based navigation in SharePoint 2013

An exciting new feature in SharePoint 2013 is managed navigation. This feature allows us to design a site navigation that is driven by terms or topics rather than (site) structure.
In some scenarios it makes sense to navigate to content based on terms — instead of structure. Imagine being a new employee in a large telecom company and trying to find knowledge about 4G technology. How would you start navigating a structure to find such knowledge? By business unit? By teams? By technology?
The managed navigation feature allows you to keep up with changes and trends and provide great navigation around important business concepts without changing the structure of your site.
The new navigation feature also provides a way to implement user — and SEO friendly URL's.
You still have to organize your content in site structures in SharePoint, but think of the managed navigation as a layer on top (of the site structure) that allows you to create links directly to content that could be hosted deep in the structure.
This post is a quick introduction on how to configure managed navigation and a peek into some of the possibilities this new feature provides.
Enable Managed Navigation
Under Site Settings / Look and Feel click on Navigation.
This page allows you to select managed navigation for your global and current navigation. Note that you still have the option to run in "classic" mode (structural navigation):
Other settings on this page allow you to define the term set that will be used for navigation terms and if new pages created should be added to the term set automatically. You can also specify if friendly URL's should be created automatically.

Edit navigation
When managed navigation is enabled you can easily manage the terms (or menu items), their relationship to each other and other properties e.g., friendly URL, using the Term Store Management Tool.
A new term set is created within the site collection Term Store to host all terms associated with the navigation. When clicking on one of the terms additional tabs are visible (on the top of the page) allowing you to configure the terms according to your needs:

I have created a simple navigation structure to demonstrate some of the new capabilities. The navigation items are Home, HR and Ops. Home also has a sub item (News). This is how the navigation shows up for the users:
This is how the sub item shows up:
This is how the navigation items shows up in the Term Store Management Tool (Site Settings / Site Administration / Term Store Management):
My navigation consists of both simple links and term-driven pages with a friendly URL.
Simple links:
The HR node is configured with a link to a page the user will be taken to when clicking on the menu item:

Term-driven pages:
The Ops node is configured as a "Term Driven Page with Friendly URL", and the details about which page to load and how the URL should be presented are configured the following way:

As you can see the Ops page is actually hosted in a page library in a site named /ops/ which is a sub site of /hr/; thus, the navigation structure is different than the site structure.
The absolute URL to this page is /hr/ops/Pages/home.aspx, but the friendly URL is presented as expected:

Wednesday, February 24, 2016

SharePoint Central Administration HTTP Error 503. The service is unavailable

How to: Enable SharePoint 2013 Central Administration when it displays “HTTP Error 503. The service is unavailable.”

So this issue threw me off at the beginning as I had just freshly installed a SharePoint 2013 server and who would possibly expect that right out of the box the thing won’t work. Regardless, after doing some digging in the event logs and on IIS it turns out the SharePoint application pools were stopped as the domain user I had provided for some reason didn’t have enough permissions to run as a service / batch job. As you can imagine, all you need to do at this point is give that user the right permissions and you are good to go. Be sure to check you have the right username/password and that the account is not locked too!
  1. Open the “Local Security Policy” however you can (Windows 2012 you can just hit the Windows key and type that or for older versions go to: Control Panel >> Administrative Tools >> Local Security Policy)
  2. Go to Security Settings
  3. Then Local Policies
  4. Finally User Rights Assignment
  5. There you will find “Log on as a batch job”. Go in there and add the user you set up on your SharePoint 2013 installation!

Wednesday, January 13, 2016

Enable and Configure Hyper-V on Windows 8 step by step

Hyper-v is virtualization solution is now available on Windows 8.  You can read more about Hyper-v here. 
and you don’t have windows 8. you can buy and  download it from here.
Hyper-V is not enabled by default on windows 8. For enabling this 
go to Control Panel >> Programs and Features >> on the left panel Click on “Turn Windows features on or off”.
Select  “Hyper-V” option and Click on OK.

Feature on or off

Once the installation done. It will prompt to reboot machine. 
After machine restarted you can see Hyper-v on start metro interface. 
Hyper-V manager

Create New Virtual Machine 
1) Open Hyper-V manager, on the right panel Click on New option Select New Virtual Machine
New Virtual Machine 

2)  Click on Next.

First Next 

3) Enter Name of Virtual Machine and by selecting check box you can change Virtual Disk location where it will be stored.

Virtual Machine Name

4)  Specify amount of memory to allocate to virtual drive.
Select Use Dynamic Memory for this virtual machine.  Click on Next.
This will allocation only amount of memory that is needed for your virtual machine remaining can be 
used by host machine.

Dynamic Memory Allocatio

5)  Select Network Adapter which is available on your machine and Click on  Next button.
If it’s your first time, I will explain later in this post,  how to Create Network Adapter. 
Select Network Adapter 


6) Now you can set how much memory you have to allocate to Virtual Disk. by default it’s set to 127 GB.
I keep as it is. Now here, you can see the extension of virtual machine is .VHDX which is new format introduced 
in Hyper-V 3  which supports data storage capacity of 64 TB.
Also you can attach existing virtual machine by selecting second option and even you can attach virtual disk
later. 
I am selecting first option.

Connect Virtual Hard Disk

7) Attach ISO image of any operating system which you want to install by selecting second option.
Click on Next.
Select OS 

8) Click on Finish button to create virtual machine. If you want to change any settings you can click on Previous button and can do that.

Finish Step 

In Hyper-V manager you can see my Virtual Machine named “Windows Server” has been created. 

Hyper-V VM

Create Network Adapter 
To create Network adaption go to option Virtual Switch Manager option from the right sidebar option. 
Network Switch 

Select Internal  switch type if you want to connect virtual disk to the Physical Machine. Using this switch you
can not access physical network oh the host machine.
Click on Create Virtual Switch. 

Give name to Internal Switch and Click on OK. 
Internal Network 

And Now go to Hyper-V Manager, Right click on Virtual Machine and Click on Settings. 
Click on Network Adapter option from left panel. and Select newly created Network Adapter switch.
Attach Network Card  

Create External Wi-Fi Network Adapter
Select External Network adapter and click on OK.
 Create External Switch 

Enter name for switch “External wi-fi Ethernet”  and select External Network card from dropdown list and click Apply
and Ok.

Apply External Network 
Start Virtual Machine

Right click on Virtual machine and click on Start option, this will start virtual machine. and double click on Virtual Machine 
then Hyper-V Virtual Machine connection will open. 
Start installation of OS.
Once OS is installed. Go to Action tab from Menu and select “Insert Integration Services Setup Disk” . 
The Integration Services are software packages that improve integration between
the virtualization server and the virtual machine.
Machine will reboot after installation of Integration Services.
Learn more about how to configure Network Adapters. 
Remote Desktop to your Virtual Machine from Host Machine

For remote desktop to your virtual machine from your host machine you need to enable remote desktop.
Go to System Properties from Control Panel and Select Remote Settings option. Under Remote tab 
select second option Allow connections from computers running any version of Remote Desktop

Remote Desktop option

Now you need IP address of virtual machine for remote desktop. 
Get the IP address of virtual machine and Open Remote Desktop Connection on host / physical machine 
by typing “mstsc”  in RUN
Enter IP address of your virtual machine and click on Connect.

Remote Desktop Connection 

Next a window will pop up for Security Credentials. 
Username will be your : Computer name\Username
Password will be your user password for that username. 
Security Credentials 

That’s it. you will be logged in to your virtual machine from Remote Desktop Connection.