Friday, March 17, 2017

Configuration an environment for apps for SharePoint 2013

There are a lot of articles in internet about it (like this on msdn:  https://technet.microsoft.com/en-us/en-en/library/fp161236.aspx), but in my one I will share my own experience of full cycle which begins with configuration of servers and ends with deploying first app.

1. Configuration of DNS server.

We have two virtual servers in our development environment:  
  •          Domain controller (DC), Domain name - dev.com
  •          SharePoint 2013 server (SP2013)
On DC server in DNS Manager I added

a)       New Host(A or AAAA) on dev.com with the same IP address:


b)       New Alias (CNAME) on dev.com like this:


2. I configured SharePoint 2013 farm by Power Shell script below:

Add-PSSnapin "Microsoft.SharePoint.PowerShell"
$appDomain = "apps.sp2013.dev.com" #your domain
$appPrefix = "app"
$accountName = "dev\spfarm" #login for pools
$accountPassword = "*********" #password

net start spadminv4
net start sptimerv4
Write-Host "Start" -foregroundcolor "green";
$existedAppDomain = Get-SPAppDomain
$existedAppPrefix = Get-SPAppSiteSubscriptionName


if (!$existedAppDomain -or !$existedAppPrefix)
{
        if (!$existedAppDomain)
        {
           Set-SPAppDomain $appDomain -ea:Stop
        }

        Get-SPServiceInstance | where{$_.GetType().Name -eq "AppManagementServiceInstance" -or $_.GetType().Name -eq "SPSubscriptionSettingsServiceInstance"} | Start-SPServiceInstance
        Get-SPServiceInstance | where{$_.GetType().Name -eq "AppManagementServiceInstance" -or $_.GetType().Name -eq "SPSubscriptionSettingsServiceInstance"}
        $User = $accountName
        $account = Get-SPManagedAccount  -Identity $User -ea:Silently
        if(!$account)
        {
           $PWord = ConvertTo-SecureString –String $accountPassword –AsPlainText -Force
           $Credential = New-Object –TypeName System.Management.Automation.PSCredential –ArgumentList $User, $PWord
           $account = New-SPManagedAccount -Credential $Credential -ea:Stop
        }
       
        $appPoolSubSvc = Get-SPServiceApplicationPool -Identity SettingsServiceAppPool
        if (!$appPoolSubSvc)
        {
           $appPoolSubSvc = New-SPServiceApplicationPool -Name SettingsServiceAppPool -Account $account
        }
        $appPoolAppSvc = Get-SPServiceApplicationPool -Identity AppServiceAppPool
        if (!$appPoolAppSvc)
        {
           $appPoolAppSvc = New-SPServiceApplicationPool -Name AppServiceAppPool -Account $account
        }

        $appSubSvc = New-SPSubscriptionSettingsServiceApplication –ApplicationPool $appPoolSubSvc –Name SettingsServiceApp –DatabaseName SettingsServiceDB
        $proxySubSvc = New-SPSubscriptionSettingsServiceApplicationProxy –ServiceApplication $appSubSvc
        $appAppSvc = New-SPAppManagementServiceApplication -ApplicationPool $appPoolAppSvc -Name AppServiceApp -DatabaseName AppServiceDB
        $proxyAppSvc = New-SPAppManagementServiceApplicationProxy -ServiceApplication $appAppSvc

        Set-SPAppSiteSubscriptionName -Name $appPrefix -Confirm:$false -ea:Stop
             Write-Host "End" -foregroundcolor "green";
}Write-Host "Registration Completed" -foregroundcolor "green";

3. Next, I created a simple SharePoint 2013 add-n app «Hellow word» and deployed it on my dev site collection.
But then I opened my deployed app I was prompted login and password multiple times with a blank page at the end. I modified my registry the way of this article described.   
I tried open my app again, entered login and passport and 'voila' the app was opened! But it was very strange:

4.  To fix it I created an empty root site collection on dev Web Application, that was all! 

5.  I also added the portal to intranet zone in IE:

Wednesday, March 15, 2017

Fixing search index after taxonomy field values changed in SharePoint

We have custom managed metadata column Tags in some lists in our SharePoint 2013 portal and this column is mapped to Managed Property Tags. After first full crawl everything was fine: customer edited items (filled tags column) and after incremental crawl completed search index updated correctly.

But if Taxonomy term store was modified  (Default label was changed, terms were merged etc.) there was a problem  - search index had old terms.

After researching the issue I found a solution.

There is standard Timer Job Taxonomy Update Scheduler  which starts every hour by default:


After Timer Job completed (you can run it manually) you need start a Full Crawl for search content source. Then the search index will be fixed and you would find items in search result by modified taxonomy field values.

P.S. Here is an article about Taxonomy Update Scheduler in 2010. In SharePoint 2013 you don’t need to wait for completing of this Timer Job to see term changes on list views or forms. It’s actual only for search.