Saturday, 23 February 2013

How add a Promoted links web-part to SharePoint 2013 app default page

This article helps you to add Promoted links web part to your default app page as the following figure:

To do this follow the following steps:
  1. Open the shortcut menu for the project, and then choose Add, New Item
    Add Picture Textbox, and two buttons to infopath form

  2. In the Templates pane, choose the List template, and then choose the Add button :

  3. Enter list name and choose the Create a non-customizable list based on an existing list type of option button, and then, in its list, choose Promoted links, and then choose the Finish button
    Binding the CAPTCHA image

  4. In Solution Explorer, under the list instance node, open the Elements.xml file. Add the promoted links items as the following:

    <?xml version="1.0" encoding="utf-8"?>
    <Elements xmlns="">
      <ListInstance Title="MyPromotedLinks"
                    Description="My List Instance">
              <Field Name="Title">Twitter</Field>
              <Field Name="BackgroundImageLocation">/PromotedLinksApp/Images/twitter.png</Field>
              <Field Name="Description">Muawiyah Shannak Twitter</Field>
              <Field Name="LinkLocation" ></Field>
              <Field Name="Order">1</Field>
              <Field Name="Title">Blog</Field>
              <Field Name="BackgroundImageLocation">/PromotedLinksApp/Images/blogger.png</Field>
              <Field Name="Description">Muawiyah Shannak Blog</Field>
              <Field Name="LinkLocation" ></Field>
              <Field Name="Order">1</Field>
              <Field Name="Title">Linkedin</Field>
              <Field Name="BackgroundImageLocation">/PromotedLinksApp/Images/linkedin.png</Field>
              <Field Name="Description">Muawiyah Shannak Linkedin</Field>
              <Field Name="LinkLocation" ></Field>
              <Field Name="Order">1</Field>

  5. In Solution Explorer, under the Pages node, open the Default.aspx file. Add following tags inside the PlaceHolderMain Place Holder:

     <WebPartPages:WebPartZone ID="WebPartZone" runat="server" FrameType="None">
                <WebPartPages:XsltListViewWebPart ID="XsltListViewAppPromotedList"
                    runat="server" ListUrl="Lists/MyPromotedLinks" IsIncluded="True"
                    NoDefaultStyle="TRUE" Title="Images used in switcher"
                    PageType="PAGE_NORMALVIEW" Default="False"

  6. Deploy a solution and you will find nice promoted links web part in the app default page!

Saturday, 16 February 2013

Powershell script to Download SharePoint 2013 Pre-Requisites

When you need to install SharePoint offline (when you don’t have internet access in SharePoint server) ,  you should download all of the software prerequisites, All of these prerequisites needed for a successful installation are listed in this blog post:

Or you can download the following Powershell script and run it on your machine to download these software prerequisites.

Download "Script to Download SharePoint 2013 Pre-Requisites" powershell file:

# This commands script file creates a new BITS transfer job that downloads all Sharepoint 2013 Prerequisites files
# Author: Muawiyah Shannak (@MuShannak)
# Blog:
# Last Update : 2/11/2013
# Source:

$DestinationFolder = Read-Host -Prompt "Please enter the destination path for Sharepoint 2013 Prerequisites files"

# Note: The Prerequisite Files URLs are subject to change at Microsoft's discretion - check and update the links.
$FilesUrlList = (""# Microsoft .NET Framework version 4.5
             ""# SQL Server 2008 R2 SP1 Native Client
             ""# Microsoft WCF Data Services 5.0
             ""# Microsoft Information Protection and Control Client (MSIPC)
             ""# Microsoft Sync Framework Runtime v1.0 SP1 (x64) 
             ""# Windows Management Framework 3.0 which includes Windows PowerShell 3.0
             ""# Windows Identity Extensions
             ""# Windows Identity Foundation (KB974405)
             ""#Windows Server AppFabric
             "" # CU 1 for AppFabric 1.1 (KB2671763)

function CreateDestinationFolder()
        ## Return true if the Destination Folder exists, otherwise return false
        If (!(Test-Path "$DestinationFolder" -pathType container))
            ##Creates the destination folder if it does not exist
            New-Item $DestinationFolder -ItemType Directory
        Write-Host "An error occurred creating destination folder (`'$DestinationFolder`'), Please check the path,and try again."

function DownloadSP2013Files()
    Import-Module BitsTransfer
    Write-Host "BitsTransfer Module is loaded"
    Write-Host "Downloading..."

    ForEach ($FileUrl in $FilesUrlList)
        ## Get the file name
        $DestinationFileName = $FileUrl.Split('/')[-1]
            ## Return true if the file exists, otherwise return false
            If (!(Test-Path "$DestinationFolder\$DestinationFileName"))
                Write-Host "`'$FileUrl`' ..."
                Start-BitsTransfer -Source $FileUrl -Destination $DestinationFolder\$DestinationFileName -Priority High -ErrorVariable err
                If ($err) {Throw ""}
                Write-Host "File $DestinationFileName already exists, skipping..."
            Write-Warning "An error occurred downloading `'$DestinationFileName`'"

function Pause($Message="Press any key to continue...")
    Write-Host -NoNewLine $Message
    $null = $host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
    Write-Host ""


Tuesday, 12 February 2013

Error occurred in deployment step ‘Recycle IIS Application Pool’ – SharePoint 2013 and Visual studio 2012

If you working on a SharePoint 2013 Visual Studio 2012 project. And after you have created a Visual web part then you tried to deploy to SharePoint Site collection. May you got the following error:

Error occurred in deployment step 'Recycle IIS Application Pool': Cannot connect to the SharePoint site: http://servername/. Make sure that this is a valid URL and the SharePoint site is running on the local computer. If you moved this project to a new computer or if the URL of the SharePoint site has changed since you created the project, update the Site URL property of the project.

  • First you should open the web site and check wither it is opening in the browser or not. If it’s not work then you should check the SharePoint servers are running.
  • Second, If the web site is open successfully then you should Restart visual studio.
  • Finally, if the site is open successfully and you had Restarted visual studio. then you should check if the  current user on the web content database is owner.  If not then add the current user to the web content database with owner role.