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="http://schemas.microsoft.com/sharepoint/">
      <ListInstance Title="MyPromotedLinks"
                    OnQuickLaunch="TRUE"
                    TemplateType="170"
                    FeatureId="192efa95-e50c-475e-87ab-361cede5dd7f"
                    Url="Lists/MyPromotedLinks"
                    Description="My List Instance">
        <Data>
          <Rows>
            <Row>
              <Field Name="Title">Twitter</Field>
              <Field Name="BackgroundImageLocation">/PromotedLinksApp/Images/twitter.png</Field>
              <Field Name="Description">Muawiyah Shannak Twitter</Field>
              <Field Name="LinkLocation" >https://twitter.com/MuShannak</Field>
              <Field Name="Order">1</Field>
            </Row>
            <Row>
              <Field Name="Title">Blog</Field>
              <Field Name="BackgroundImageLocation">/PromotedLinksApp/Images/blogger.png</Field>
              <Field Name="Description">Muawiyah Shannak Blog</Field>
              <Field Name="LinkLocation" >http://mushannak.blogspot.com</Field>
              <Field Name="Order">1</Field>
            </Row>
            <Row>
              <Field Name="Title">Linkedin</Field>
              <Field Name="BackgroundImageLocation">/PromotedLinksApp/Images/linkedin.png</Field>
              <Field Name="Description">Muawiyah Shannak Linkedin</Field>
              <Field Name="LinkLocation" >http://ae.linkedin.com/in/shannak</Field>
              <Field Name="Order">1</Field>
            </Row>
          </Rows>
        </Data>
      </ListInstance>
    </Elements>

  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"
                    ViewContentTypeId="0x">
                </WebPartPages:XsltListViewWebPart>
           </WebPartPages:WebPartZone>



  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: http://blogs.technet.com/b/meamcs/archive/2012/12/26/install-and-download-sharepoint-2013-prerequisites-offline-manually.aspx

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: http://gallery.technet.microsoft.com/office/Script-to-SharePoint-2013-702e07df

Script:
# This commands script file creates a new BITS transfer job that downloads all Sharepoint 2013 Prerequisites files
# Author: Muawiyah Shannak (@MuShannak)
# Blog: http://mushannak.blogspot.com/
# Last Update : 2/11/2013
# Source: http://gallery.technet.microsoft.com/Script-to-SharePoint-2013-702e07df

$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 http://technet.microsoft.com/en-us/library/cc262485(v=office.15).aspx and update the links.
$FilesUrlList = ("http://download.microsoft.com/download/D/0/F/D0F564A3-6734-470B-9772-AC38B3B6D8C2/dotNetFx45_Full_x86_x64.exe"# Microsoft .NET Framework version 4.5
             "http://download.microsoft.com/download/9/1/3/9138773A-505D-43E2-AC08-9A77E1E0490B/1033/x64/sqlncli.msi"# SQL Server 2008 R2 SP1 Native Client
             "http://download.microsoft.com/download/8/F/9/8F93DBBD-896B-4760-AC81-646F61363A6D/WcfDataServices.exe"# Microsoft WCF Data Services 5.0
             "http://download.microsoft.com/download/9/1/D/91DA8796-BE1D-46AF-8489-663AB7811517/setup_msipc_x64.msi"# Microsoft Information Protection and Control Client (MSIPC)
             "http://download.microsoft.com/download/E/0/0/E0060D8F-2354-4871-9596-DC78538799CC/Synchronization.msi"# Microsoft Sync Framework Runtime v1.0 SP1 (x64) 
             "http://download.microsoft.com/download/5/2/B/52B59966-3009-4F39-A99E-3732717BBE2A/Windows6.1-KB2506143-x64.msu"# Windows Management Framework 3.0 which includes Windows PowerShell 3.0
             "http://download.microsoft.com/download/0/1/D/01D06854-CA0C-46F1-ADBA-EBF86010DCC6/r2/MicrosoftIdentityExtensions-64.msi"# Windows Identity Extensions
             "http://download.microsoft.com/download/D/7/2/D72FD747-69B6-40B7-875B-C2B40A6B2BDD/Windows6.1-KB974405-x64.msu"# Windows Identity Foundation (KB974405)
             "http://download.microsoft.com/download/A/6/7/A678AB47-496B-4907-B3D4-0A2D280A13C0/WindowsServerAppFabricSetup_x64.exe"#Windows Server AppFabric
             "http://download.microsoft.com/download/7/B/5/7B51D8D1-20FD-4BF0-87C7-4714F5A1C313/AppFabric1.1-RTM-KB2671763-x64-ENU.exe" # CU 1 for AppFabric 1.1 (KB2671763)
             )

function CreateDestinationFolder()
{
    Try
    {
        ## 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
        }
    }
    Catch
    {
        Write-Host "An error occurred creating destination folder (`'$DestinationFolder`'), Please check the path,and try again."
        Pause
        break
    }
}

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]
   
        Try
        {
           
            ## 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 ""}
            }
            Else
            {
                Write-Host "File $DestinationFileName already exists, skipping..."
            }
        }
        Catch
        {
            Write-Warning "An error occurred downloading `'$DestinationFileName`'"
            break
        }
    }
}

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

CreateDestinationFolder
DownloadSP2013Files
Pause
 ###################################

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.