Archive

Archive for the ‘SharePoint2013Preview’ Category

How to use call web service action in SharePoint2013 workflow

September 8, 2012 5 comments

In SharePoint2013, you can use call web service action and loop. In this post, I will show you how to achieve this.

1. Create a List workflow called CallWebService


2. Create a variable called listurl and assign the value to http://sp2010/_vti_bin/listdata.svc


3. Create a dictionary variable called RequestHeaders and add the following key value pairs.


4. Call the web service with the HttpHeaders you just build in the previous step and store the response in the variable ResponseContent.


5. The ResponseContent variable is the Dynamic values (in SharePoint designer it will be called dictionary type) and it is new feature for SharePoint2013 workflow. We can use the following actions to count the number items in the variable.


6. You can use loop in SharePoint 2013 workflow and out each list title as shown below.

How to fix “The requested service, ‘net.pipe://localhost/SecurityTokenServiceApplication/appsts.svc’ could not be activated.”

September 2, 2012 6 comments

Problem:

When I try to publish a SharePoint2013 workflow, I received the error:

The requested service, ‘net.pipe://localhost/SecurityTokenServiceApplication/appsts.svc’ could not be activated.

After that, my workflow stopped working and every time I start a work I receive the following error message:


System.ApplicationException: PreconditionFailed ---> System.ApplicationException: Error in the application. --- End of inner exception stack trace --- at System.Activities.Statements.Throw.Execute(CodeActivityContext context) at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager) at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)

Analysis:

After analysis, I found the error by visiting the http://localhost:32843/SecurityTokenServiceApplication/securitytoken.svc and the error I got on the message is                                                                                                                                             

Solution:

The solution is basically getting more memory to the server. For development environment, you can restart your noderunner.exe or some other services to release some memories. To verify you have enough memory    you can browse to http://localhost:32843/SecurityTokenServiceApplication/securitytoken.svc , it should return the information below. Then you can republish your workflow and it will work like a charm.

                                                    


How to create managed properties at site collection level in SharePoint2013

August 26, 2012 1 comment

In SharePoint2013, you can create managed properties at site collection. Today, I’d like to show you how to do so through PowerShell.

1. Define your managed properties and crawled properties and managed property Type in an external csv file. PowerShell script will read this file and create the managed and the mapping.

2. As you can see I also defined variant Type, this is because you need the variant type to create the crawled property. In order to have the crawled properties, you need to do a full crawl and also make sure you have data populated for your custom column. However, if you do not want to a full crawl to create those crawled properties, you can create them yourself by using the PowerShell; however you need to make sure the crawled properties you created have the same name if created by a full crawl.

Managed properties type:
Text = 1
Integer = 2
Decimal = 3
DateTime = 4
YesNo = 5
Binary = 6

Variant Type:
Text = 31
Integer = 20
Decimal = 5
DateTime = 64
YesNo = 11

3. You can use the following script to create your managed properties at site collection level, the differences for creating managed property at site collection level is to pass in the site collection id.

param(
	[string] $siteUrl="http://SP2013/",
	[string] $searchAppName = "Search Service Application",
    $ManagedPropertiesList=(IMPORT-CSV ".\ManagedProperties.csv")
)
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
$searchapp = $null

function AppendLog
{
	param ([string] $msg,
			[string] $msgColor)

	$currentDateTime = Get-Date
	$msg = $msg + " --- " + $currentDateTime

	if (!($logOnly -eq $True))
	{
		# write to console
		Write-Host -f $msgColor $msg
	}

	# write to log file
	Add-Content $logFilePath $msg
}

$scriptPath = Split-Path $myInvocation.MyCommand.Path
$logFilePath = $scriptPath + "\CreateManagedProperties_Log.txt"

function CreateRefiner
{param ([string] $crawledName, [string] $managedPropertyName, [Int32] $variantType, [Int32] $managedPropertyType,[System.GUID] $siteID)

	$cat = Get-SPEnterpriseSearchMetadataCategory –Identity SharePoint -SearchApplication $searchapp

	$crawledproperty = Get-SPEnterpriseSearchMetadataCrawledProperty -Name $crawledName -SearchApplication $searchapp -SiteCollection $siteID

	if($crawledproperty -eq $null)
	{
		Write-Host
		AppendLog "Creating Crawled Property for $managedPropertyName" Yellow
		$crawledproperty = New-SPEnterpriseSearchMetadataCrawledProperty -SearchApplication $searchapp -VariantType $variantType -SiteCollection $siteID -Category $cat -PropSet "00130329-0000-0130-c000-000000131346" -Name $crawledName -IsNameEnum $false
	}

	$managedproperty = Get-SPEnterpriseSearchMetadataManagedProperty -Identity $managedPropertyName -SearchApplication $searchapp -SiteCollection $siteID  -ErrorAction SilentlyContinue

	if($managedproperty -eq $null)
	{
		Write-Host
		AppendLog "Creating Managed Property for $managedPropertyName" Yellow
		$managedproperty = New-SPEnterpriseSearchMetadataManagedProperty -Name $managedPropertyName -Type $managedPropertyType -SiteCollection $siteID -SearchApplication $searchapp -Queryable:$true -Retrievable:$true -FullTextQueriable:$true -RemoveDuplicates:$false -RespectPriority:$true -IncludeInMd5:$true
	}

	$mappedProperty = $crawledproperty.GetMappedManagedProperties() | ?{$_.Name -eq $managedProperty.Name }

	if($mappedProperty -eq $null)
	{
		Write-Host
		AppendLog "Creating Crawled -> Managed Property mapping for $managedPropertyName" Yellow
		New-SPEnterpriseSearchMetadataMapping -CrawledProperty $crawledproperty -ManagedProperty $managedproperty -SearchApplication $searchapp -SiteCollection $siteID
	}

	$mappedProperty = $crawledproperty.GetMappedManagedProperties() | ?{$_.Name -eq $managedProperty.Name }  #Get-FASTSearchMetadataCrawledPropertyMapping -ManagedProperty $managedproperty
}

$searchapp = Get-SPEnterpriseSearchServiceApplication $searchAppName
$site= Get-SPSite $siteUrl
$siteId=$site.id

Write-Host "Start creating Managed properties"
$i = 1
FOREACH ($property in $ManagedPropertiesList) {
    $propertyName=$property.managedPropertyName
    $crawledName=$property.crawledName
    $managedPropertyType=$property.managedPropertyType
    $variantType=$property.variantType
    Write-Host $managedPropertyType
    Write-Host "Processing managed property $propertyName  $($i)..."
	$i++
    CreateRefiner $crawledName $propertyName $variantType $managedPropertyType $siteId
	Write-Host "Managed property created " $propertyName
}

Key Concepts

Crawled Properties: Crawled properties are discovered by the search index service component when crawling content.

Managed Properties: Properties that are part of the Search user experience, which means they are available for search results, advanced search, and so on, are managed properties.

Mapping Crawled Properties to Managed Properties: To make a crawled property available for the Search experience—to make it available for Search queries and display it in Advanced Search and search results—you must map it to a managed property.

References

Administer search in SharePoint 2013 Preview

Managing Metadata

New-SPEnterpriseSearchMetadataCrawledProperty

New-SPEnterpriseSearchMetadataManagedProperty

Remove-SPEnterpriseSearchMetadataManagedProperty

Overview of crawled and managed properties in SharePoint 2013 Preview

Remove-SPEnterpriseSearchMetadataManagedProperty

SharePoint 2013 – Search Service Application

How to fix “Add Host to Workflow Farm problem” when installing Windows Azure Workflow in SharePoint2013 Preview

July 23, 2012 Leave a comment

Problem:

When I try to configure the windows Azure workflow in SharePoint2013 preview, I got the following error see screenshot below. Detailed log can be found here.

Solution:

I asked the question in SharePoint StackExchange , Rajat’s help me to fix the problem .The solution for this is quite simple, instead of using the short form for your RunAs account, you should use the fully qualified name. So change administrator@YBBEST to administrator@YBBEST.COM
make the problem go away as shown below.

Additional problems you may face:

1.You also need to create an App Management  Service application and make sure App Management Service is started as shown below,otherwise you can not publish your SharePoint2013 workflow.

Having other problems , check out AC’S blog on trouble-shooting the installation.

References:

How to: Set up and configure SharePoint 2013 workflows

How to install SharePoint Server 2013 Preview

July 18, 2012 Leave a comment

The Office 2013 and SharePoint Server 2013 Preview is announced yesterday and as a SharePoint Developer, I am really excited to learn all the new features and capabilities. Today I will show you how to install the preview.

1. Create a service account called SP2013Install and give this account Dbcreator and SecurityAdmin in SQL Server 2012

2. You need to run the following script to set the ‘maxdegree of parellism’ setting to the required value of 1 in SQL Server 2012(using sysadmin privilege) before configure the SharePoint Farm. Otherwise , you might get the error ‘This SQL Server Instance does not have the required maxdegree of parellism setting of 1’

sp_configure 'show advanced options', 1;
GO
RECONFIGURE WITH OVERRIDE;
GO
sp_configure 'max degree of parallelism', 1;
GO
RECONFIGURE WITH OVERRIDE;
GO

3. Download the SharePoint preview from here and I am going to install it on Windows Server 2008R2 with SQL2012.

4. Click the Install software prerequisites, this works fine with the internet connection. (However, if you do not have internet connection, it is a bit tricky to install window azure AppFabric as it has to be installed using the prerequisite installer. Your computer might reboot a few times in the process.)

5.After the prerequisites are installed `completely, you can then install the Preview. Click the Install SharePoint Server and Enter the Product key you get from the Preview download page.

6. Accept the License terms and Click Next.

7. Leave the default path for the file location.

8. You can now start the installation process

9. After binary files are installed, you then can configure your farm using the farm configuration wizard.

10.Specify the Database server and the install account

11. Specify SharePoint farm passphrase.

12 Specify the port number , you should choose your own favorite port number.

13. Choose Create a New Server Farm and click next.

14. Double-check with the settings and click Next to Configure the farm install.

15. Finally, your farm is configured successfully and you now are able to go to your Central Admin site http://sp2010:6666/

16. You should configure the services manually or automate using PowerShell (If you like to understand why,you can read the blog post here) ,however I will use the wizard to configure automatically here  as  this is a test machine. After the configuration is complete, you now be able to see your SharePoint Site.

17.To start the evaluate the Preview , you need to install Visual Studio 2012 RC , Microsoft Office Developer Tools for Visual Studio 2012,SharePoint 2013 Designer Preview , Office 2013 Preview.

References:

Download SharePoint2013 Server 2013

Download Microsoft Visio Professional 2013 Preview

Install SharePoint 2013 Preview

Hardware and software requirements for SharePoint 2013 Preview

SharePoint 2013 IT Pro and Developer training materials released

Plan for SharePoint 2013 Preview

Microsoft Office Developer Tools for Visual Studio 2012

SharePoint 2013 Preview

Office365 for the SharePoint 2013 preview

SharePoint Designer 2013

Download: Microsoft Office 2013 Preview Language Pack

Try Office