Blog Archives

Create SharePoint 2016 install package with AutoSPSourceBuilder

Hey Everyone!

Today i will speak about AutoSPSourceBuilder, a great powershell script to create a packages to install SharePoint 2016, 2013 and 2010. The packages created by AutoSPBuilder,  you can use AutoSPInstaller, a greats powershell script to automize the instalation of SharePoint also available for SharePoint version 2016, 2013  and 2010.

I deeply recommend create with this script because the package will include the most recent updates of SharePoint!

Follow the steps below:

  1.  Download SharePoint 2016, you can use the following link:https://www.microsoft.com/en-us/download/details.aspx?id=51493.

2. Download AutoSPSourceBuilder, you can download on github – https://github.com/brianlala/AutoSPSourceBuilder.

3. Mount the .iso image of SharePoint 2016.

4. Run the script – AutoSPSourceBuilder.ps1 with Powershell as admin.

.AutoSPSourceBuilder.ps1 -GetPrerequisites $true

5. The script will start and the firstly  check if exists SharePoint image,  if exists it will create a struct of folders in disk drive c.

6. You need select what is the last update that you what include on your installation package, as SharePoint 2016 updates are cumulative you just need to select the last one.

7. The script continue… and install the prerequisites.

8. Select the language pack that you want include on your installation.

9. Finally the script will finish the package.

10. At the end you have a structure of folders and files that make up your SharePoint package to run in AutoSPInstaller.


Thanks

Fábio Carvalho
SharePoint Consultant
|create|it|

 

SEO – Change Meta Tags Dynamically in SharePoint or Asp.net – (JavaScript & C#) – Google Crawlers

Google-Crawl-Index-550x331

Meta tags are a great way for webmasters to provide search engines with information about their sites. They can be used to provide information to all sorts of clients, and each system processes.

Meta tags are added to the <head> section of your HTML page and you can add them dynamically use JavaScript when page load or using c#:

The following examples explain how can you add it on your header Page:

1. Use c#

public static void ApplyTagsCSharp(string xtitle, string xkeywords, 
string xdescription, Page page)
        {
            page.Title = xtitle;
            ContentPlaceHolder contentPlaceHolder = 
           (ContentPlaceHolder)page.Master.FindControl("PlaceHolderPageTitle");
            contentPlaceHolder.SetRenderMethodDelegate
            (delegate(System.Web.UI.HtmlTextWriter writer,
            System.Web.UI.Control Container)
            {
                writer.Write(xtitle);
            });

            ////Add Keywords Meta Tag
            HtmlMeta keywords = new HtmlMeta();
            keywords.HttpEquiv = "keywords";
            keywords.Name = "keywords";
            keywords.Content = xkeywords;
            page.Header.Controls.Add(keywords);

            //Add Description Meta Tag
            HtmlMeta description = new HtmlMeta();
            description.HttpEquiv = "description";
            description.Name = "description";
            description.Content = xdescription;
            page.Header.Controls.Add(description);
        }

2. Use JavaScript with ClientScriptManager

public static void ApplyTagsJS(string title, string keywords, 
string description, string author, ClientScriptManager csx, System.Type tp)
        {
            String csname2 = "isTagFunction";
            Type cstype2 = tp;

            if (!csx.IsStartupScriptRegistered(cstype2, csname2))
            {
                StringBuilder cstext2 = new StringBuilder();
                cstext2.Append("");
                if (!string.IsNullOrEmpty(keywords))
                {
                    cstext2.Append("$('meta[name=keywords]').remove();");
                    cstext2.AppendFormat("$('head').append( '');", keywords);
                }
                if (!string.IsNullOrEmpty(description))
                {
                    cstext2.Append("$('meta[name=description]').remove();");
                    cstext2.AppendFormat("$('head').append( '' );", description);
                }
                if (!string.IsNullOrEmpty(title))
                {
                  cstext2.AppendFormat("document.title = \"{0}\"; ", title);
                }
                csx.RegisterStartupScript(cstype2, csname2, cstext2.ToString());
            }
        }

Thanks

Script to Change Page Layout on Publishing Pages – PowerShell

If you want change pagelayouts, you can use this usefull script.

$spWeb = Get-SPWeb("http://fcsharepoint")
$pWeb = [Microsoft.SharePoint.Publishing.PublishingWeb]::GetPublishingWeb($spWeb)
$pSite = New-Object Microsoft.SharePoint.Publishing.PublishingSite($spWeb.Site);

$siteLayouts = $pSite.GetPageLayouts($false)
$myLayout = $siteLayouts["/_catalogs/masterpage/fcPageLayout.aspx"]
$query = New-Object Microsoft.SharePoint.SPQuery
$query.ViewAttributes = "Scope='RecursiveAll'"

$pages = $pWeb.GetPublishingPages($query)

foreach ($page in $pages)
{
     if ($page.ContentType.Name -eq "Folder")
     {
         continue
     } 
     $page.Layout = $myLayout
     $page.update()
     $page.ListItem.File.Publish("")
     $page.ListItem.File.Approve("")
}
$spWeb.Dispose()

Listing / Installing / Uninstalling / Enabling / Disabling Features on Farm, Site Collection and Site – Sharepoint Powershell

Listing Features

Show all the features on the farm:

 Get-SPFeature | Sort -Property DisplayName

Show all the features on the Farm grouped by scope in a table use:

 Get-SPFeature | Sort -Property DisplayName, Scope | FT -GroupBy Scope DisplayName

Show all features for a Web Application:

 Get-SPFeature -WebApplication http://webapplication

Show all features for a Site Collection:

 Get-SPFeature -Site http://sitecollection

Show all features for a Site:

 Get-SPFeature -Web http://siteurl

Enabling and Disabling Features

To disable and enable features:

Disable-SPFeature

 Disable-SPFeature -Identity "NameOfFeature" -URL http://url

Enable-SPFeature

 Enable-SPFeature -Identity "NameOfFeature" -URL http://url

Installing and Uninstalling Features

To install and uninstalling a feature you need to specify the name of the folder that your feature contains:

Install-SPFeature
 Install-SPFeature "FeatureFolderName"
Uninstall-SPFeature
Uninstall-SPFeature "FeatureFolderName"

Creating Subsites using Powershell Script & List of SharePoint 2013 Template Sites

How to create a sub site using Power Shell scripts:

To add a new subsite use the New-SPWeb powershell command

New-SPWeb –url <new site url> -name <new site name> -template <template name>

Additional cmdlet which can be used: 

AddToTopNav: Add the site to the top navigation bar 

 UseParentTopNav: Use the top navigation bar from the parent

 AddToQuickLaunch: Add the new site to the Quick Launch section

– UniquePermissions: Break parent permissions, and will create for new Subsite.

Example:

$WebAppUrl="http://fcSharePoint:5000"

#->SubSite1<-
$SubSiteTitle1 = "This is SubSite  - 1 - Title"
$SubSite1Url = "SubSite1"
New-SPWeb –url $WebAppUrl"/"$SubSite1Url -name $SubSiteTitle1 -Template "STS#0" 
–AddToTopNav –UniquePermissions –UseParentTopNav
Write-Host 'Create new SubSite:' $SubSiteTitle1 '-> Url:'$WebAppUrl"/"$SubSite1Url

#->SubSite2<-
$SubSiteTitle2 = "This is SubSite - 2 - Title"
$SubSite2Url = "SubSite2"
New-SPWeb –url $WebAppUrl"/"$SubSite2Url -name $SubSiteTitle2 -Template "STS#0" 
–AddToTopNav –UniquePermissions –UseParentTopNav
Write-Host 'Create new SubSite:' $SubSiteTitle2 '-> Url:'$WebAppUrl"/"$SubSite2Url

#->SubSite3<-
$SubSiteTitle3 = "This is SubSite - 3 - Title"
$SubSite3Url = "SubSite3"
New-SPWeb –url $WebAppUrl"/"$SubSite3Url -name $SubSiteTitle3 -Template "STS#0" 
–AddToTopNav –UniquePermissions –UseParentTopNav
Write-Host 'Create new SubSite:' $SubSiteTitle3 '-> Url:'$WebAppUrl"/"$SubSite3Url

List of SharePoint 2013 Template Sites:

Template ID Title
GLOBAL#0 Global template
STS#0 Team Site
STS#1 Blank Site
STS#2 Document Workspace
MPS#0 Basic Meeting Workspace
MPS#1 Blank Meeting Workspace
MPS#2 Decision Meeting Workspace
MPS#3 Social Meeting Workspace
MPS#4 Multipage Meeting Workspace
CENTRALADMIN#0 Central Admin Site
WIKI#0 Wiki Site
BLOG#0 Blog
SGS#0 Group Work Site
TENANTADMIN#0 Tenant Admin Site
APP#0 App Template
APPCATALOG#0 App Catalog Site
ACCSRV#0 Access Services Site
ACCSRV#1 Assets Web Database
ACCSRV#3 Charitable Contributions Web Database
ACCSRV#4 Contacts Web Database
ACCSRV#5 Projects Web Database
ACCSRV#6 Issues Web Database
ACCSVC#0 Access Services Site Internal
ACCSVC#1 Access Services Site
BDR#0 Document Center
DEV#0 Developer Site
DOCMARKETPLACESITE#0 Academic Library
EDISC#0 eDiscovery Center
EDISC#1 eDiscovery Case
OFFILE#0 (obsolete) Records Center
OFFILE#1 Records Center
OSRV#0 Shared Services Administration Site
PPSMASite#0 PerformancePoint
BICenterSite#0 Business Intelligence Center
SPS#0 SharePoint Portal Server Site
SPSPERS#0 SharePoint Portal Server Personal Space
SPSPERS#2 Storage And Social SharePoint Portal Server Personal Space
SPSPERS#3 Storage Only SharePoint Portal Server Personal Space
SPSPERS#4 Social Only SharePoint Portal Server Personal Space
SPSPERS#5 Empty SharePoint Portal Server Personal Space
SPSMSITE#0 Personalization Site
SPSTOC#0 Contents area Template
SPSTOPIC#0 Topic area template
SPSNEWS#0 News Site
CMSPUBLISHING#0 Publishing Site
BLANKINTERNET#0 Publishing Site
BLANKINTERNET#1 Press Releases Site
BLANKINTERNET#2 Publishing Site with Workflow
SPSNHOME#0 News Site
SPSSITES#0 Site Directory
SPSCOMMU#0 Community area template
SPSREPORTCENTER#0 Report Center
SPSPORTAL#0 Collaboration Portal
SRCHCEN#0 Enterprise Search Center
PROFILES#0 Profiles
BLANKINTERNETCONTAINER#0 Publishing Portal
SPSMSITEHOST#0 My Site Host
ENTERWIKI#0 Enterprise Wiki
PROJECTSITE#0 Project Site
PRODUCTCATALOG#0 Product Catalog
COMMUNITY#0 Community Site
COMMUNITYPORTAL#0 Community Portal
SRCHCENTERLITE#0 Basic Search Center
SRCHCENTERLITE#1 Basic Search Center
SRCHCENTERFAST#0 FAST Search Center
visprus#0 Visio Process Repository

Template IDT