Archive
How to create multiple lines Text field that can take more than 255 characters in SharePoint2010
If you ever find the multiline textbox reach the limit of 255 characters, here is you need to do to remove the limit. You need to go to the site settings and then go to the site columns. Next, you need to go to the column setting page and change Allow unlimited length in document libraries from NO to Yes as shown below:
FROM

TO

What is new in SharePoint2013 Workflow
In SharePoint 2013, Microsoft provides a new way for creating workflows while the existing SharePoint 2010 Workflow platform has been carried forward to SharePoint 2013. SharePoint 2013 workflows are powered by Windows Workflow Foundation 4, which was substantially redesigned from earlier versions. These changes bring a major advancement to workflow and make SharePoint workflows to handle much more complex scenarios.
Let’s first look at the high-level architecture of the workflow infrastructure. As you can see from the SharePoint2013 Architecture diagram below, SharePoint 2010 workflow execution was hosted in SharePoint itself, this has been retained in SharePoint 2013 to allow for backward compatibility while Windows Azure Workflow is external to SharePoint and communicates using common protocols over the Windows Azure service bus, mediated by OAuth. Windows Azure Workflow also can be installed on a separate server. This new workflow infrastructure combined with Windows Workflow Foundation 4 provides SharePoint2013 workflow with more capabilities, such as Service Bus messaging, elastic scalability, and managed service reliability.
SharePoint2013 Architecture
Next, let’s look at what is new in SharePoint 2013 workflow and how these changes will make it more appealing than SharePoint 2010 workflow.
1. Declarative authoring in both SharePoint Designer and Visual Studio
Workflow authoring is declarative only in SharePoint2013 Workflow. It simplified the way workflows are created and also provides a consistent experience for creating workflow in SharePoint designer and Visual Studio. Workflows are no longer compiled into managed assemblies and deployed to an assembly cache. Instead, XAML files define your workflows and frame their execution. You can see screenshot below on how you create the same workflow in Visual Studio and SharePoint Designer.

SPD Declarative workflow Authoring

Visual Studio Declarative workflow Authoring
Another great feature inside SharePoint Designer is called visual designer for workflow. This feature is enabled when you have installed Visio 2013. It provides a new way to design workflow alongside the traditional text-based workflow designer as shown below.

SPD Visual Designer view
2.Workflow stages to tackle more complex workflow scenarios
This is the major improvement made by Microsoft in SharePoint 2013 workflow as it allows you to create declarative state machine workflow using SharePoint. In SharePoint 2010, you can only create sequential workflow using SharePoint Designer. If you like to create state-machine workflow, you need to get a developer involved as it can only be created inside Visual Studio. Sequential workflow can only handle simple workflow as it executes in a predefined order, on the other hand, state machine workflow can model more complex workflow as it is event driven. Depending on different state, certain actions will take place.
3. New workflow actions and data type to enhance workflow capability
SharePoint 2013 adds several new SharePoint actions to extend the workflow capability. I will highlight some of the significant ones and for a complete list of the actions in SharePoint2013, you can check the MSDN.
- Call HTTP web service: This action enable no-code web service calls from inside a workflow. Organisation can utilize this action to have a better management of integrating external processing with workflow. As business analyst can model the actual business process inside workflow while developer can expose the external processing logic via web services.
- Loop: The ability to loop through a collection is missing in SharePoint2010 and having this capability will align SharePoint processing logic with what is expected from a workflow engine.
- Dynamic value / Dictionary type: These terms refer to the same data type, dynamic value is used in Visual Studio while dictionary type is used in SharePoint Designer. This new data type used in conjunction with HTTP web service request make it much easier to consume web services from within the workflow.
- Start SharePoint2010 workflow.
There is full interoperability in SharePoint 2013 with SharePoint 2010 workflows, which is enabled by using the Workflow interop bridge.
4. Cloud ready
There is 100 percent parity in SharePoint 2013 between on-premises and Office 365 -based workflows as shown in the picture below; therefore you can easily move an on-premises workflow to the cloud. Office 365 has already got the Windows Azure Workflow installed and configured properly. You do not have to do anything if you’d like to take advantage of the new workflow capability in the Office 365.

Office365 Architecture
As you can see, Microsoft made a big investment in SharePoint2013 workflow and these changes make the SharePoint2013 workflow more robust, easier to build and provide more capabilities to help you to streamline your business processes. We are looking forward to helping your business take advantage of these new capabilities.
References:
http://technet.microsoft.com/en-us/library/jj219638%28v=office.15%29.aspx
http://msdn.microsoft.com/en-us/library/jj163181%28v=office.15%29.aspx
http://geekswithblogs.net/KunaalKapoor/archive/2012/08/14/sharepoint-2013-ndash-workflows.aspx
http://msdn.microsoft.com/en-us/library/jj163177%28v=office.15%29.aspx
http://msdn.microsoft.com/en-us/library/jj163091%28v=office.15%29.aspx
http://msdn.microsoft.com/en-us/library/jj163181(v=office.15).aspx
http://msdn.microsoft.com/en-us/library/jj163272(v=office.15).aspx
http://www.sharepointpromag.com/article/sharepoint/sharepoint-2013-features-144003
http://weblogs.asp.net/scottgu/archive/2012/07/26/windows-azure-and-office-365.aspx
How to create SharePoint2013 workflow using visual studio
If you like to use Visual Studio to create workflow in SharePoint2013, here are the steps on how to get started.
1. Create a SharePoint sandbox solution.

2. Add a list workflow

3. I add a WriteToHistory to the workflow.

4. Here is the final solution looks like:

5. Deploy the sandbox solution to your Office 365 Preview and activate the site collection feature first

6. Then you can activate the site features in the following orders

7. You can run your work as shown below


8. Navigate to your workflow history list, you will see the workflow is successfully completed.

You can download the solution here.
How to perform feature upgrade in SharePoint2010 part2
In my last post, I showed you how to perform feature upgrade and upgrade my feature from 0.0.0.0 to 1.0.0.1. In this post, I’d like to continue on this topic and upgrade the feature again.
For the first version of my solution, I deploy a document library with a custom document set content type and then upgrade the solution so I index the application number column. Now , I will create a new version of the solution so that it will remove the threshold of the list. You can download the solution here. Once you extract your solution, the first version is in the original folder. In order to deploy the original solution, you need to run the sitecreation.ps1 in the script folder. The version 1.1 will be in the Upgrade folder and version 1.2 will be in the Upgrade2 folder.
You need to make the following changes to the existing solution.
1. Modify the ApplicationLibrary.Template.xml as highlighted below:

2. Adding the following code into the feature event receiver.
</pre>
public override void FeatureUpgrading(SPFeatureReceiverProperties properties, string upgradeActionName, System.Collections.Generic.IDictionary<string, string> parameters)
{
base.FeatureUpgrading(properties, upgradeActionName, parameters);
SPWeb web = GetFeatureWeb(properties);
SPList applicationLibrary = web.Lists.TryGetList(ApplicationLibraryNamesConstant.ApplicationLibraryName);
switch (upgradeActionName)
{
case "IndexApplicationNumber":
if (applicationLibrary != null)
{
SPField queueField = applicationLibrary.Fields["ApplicationNumber"];
queueField.Indexed = true;
queueField.Update();
}
break;
case "RemoveListThreshold":
applicationLibrary.EnableThrottling = false;
applicationLibrary.Update();
break;
}
}
<pre>
3. Package your solution and run the feature upgrade PowerShell script.
$wspFolder ="v1.2" $scriptPath=Split-Path $myInvocation.MyCommand.Path $siteUrl = "http://ybbest" $featureToCheckGuid="1b9d84cd-227d-45f1-92d4-a43008aa8fe7" $requiredFeatureVersion="1.0.0.1" $siteUrlOfFeatureToBeChecked="http://ybbest" AppendLog "Starting Solution UpgradeSolutionAndFeatures.ps1" Magenta & "$scriptPath\UpgradeSolutionAndFeatures.ps1" $siteUrl $wspFolder $featureToCheckGuid $requiredFeatureVersion $siteUrlOfFeatureToBeChecked Write-Host AppendLog "All features updated" "Green"
References:
How to deploy the advanced search page using Module in SharePoint 2013
Today, I’d like to show you how to deploy your custom advanced search page using module in Visual Studio 2012.Using a module is the way how SharePoint deploy all the publishing pages to the search centre. Browse to the template under 15 hive of SharePoint2013, then go to the SearchCenterFiles under Features(as shown below).Then open the Files.xml it shows how SharePoint using module to deploy advanced search.You can download the solution here.
Now I am going to show you how to deploy your custom advanced search page.The feature is located in the C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\15\TEMPLATE\FEATURES\SearchCenterFiles .
To deploy SharePoint advanced Search pages, you need to do the following:
1. Create SharePoint2013 project and then create a module item.

2. Find how Out of box SharePoint deploy the Advanced Search Page from Files.xml and copy and paste it into the elements.xml
<File Url="advanced.aspx" Type="GhostableInLibrary"> <Property Name="PublishingPageLayout" Value="~SiteCollection/_catalogs/masterpage/AdvancedSearchLayout.aspx, $Resources:Microsoft.Office.Server.Search,SearchCenterAdvancedSearchTitle;" /> <Property Name="Title" Value="$Resources:Microsoft.Office.Server.Search,Search_Advanced_Page_Title;" /> <Property Name="ContentType" Value="$Resources:Microsoft.Office.Server.Search,contenttype_welcomepage_name;" /> <AllUsersWebPart WebPartZoneID="MainZone" WebPartOrder="1"> <![CDATA[ <WebPart xmlns="http://schemas.microsoft.com/WebPart/v2"> <Assembly>Microsoft.Office.Server.Search, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c</Assembly> <TypeName>Microsoft.Office.Server.Search.WebControls.AdvancedSearchBox</TypeName> <Title>$Resources:Microsoft.Office.Server.Search,AdvancedSearch_Webpart_Title;</Title> <Description>$Resources:Microsoft.Office.Server.Search,AdvancedSearch_Webpart_Description;</Description> <FrameType>None</FrameType> <AllowMinimize>true</AllowMinimize> <AllowRemove>true</AllowRemove> <IsVisible>true</IsVisible> <SearchResultPageURL xmlns="urn:schemas-microsoft-com:AdvancedSearchBox">results.aspx</SearchResultPageURL> <TextQuerySectionLabelText xmlns="urn:schemas-microsoft-com:AdvancedSearchBox">$Resources:Microsoft.Office.Server.Search,AdvancedSearch_FindDocsWith_Title;</TextQuerySectionLabelText> <ShowAndQueryTextBox xmlns="urn:schemas-microsoft-com:AdvancedSearchBox">true</ShowAndQueryTextBox> <ShowPhraseQueryTextBox xmlns="urn:schemas-microsoft-com:AdvancedSearchBox">true</ShowPhraseQueryTextBox> <ShowOrQueryTextBox xmlns="urn:schemas-microsoft-com:AdvancedSearchBox">true</ShowOrQueryTextBox> <ShowNotQueryTextBox xmlns="urn:schemas-microsoft-com:AdvancedSearchBox">true</ShowNotQueryTextBox> <ScopeSectionLabelText xmlns="urn:schemas-microsoft-com:AdvancedSearchBox">$Resources:Microsoft.Office.Server.Search,AdvancedSearch_NarrowSearch_Title;</ScopeSectionLabelText> <ShowLanguageOptions xmlns="urn:schemas-microsoft-com:AdvancedSearchBox">true</ShowLanguageOptions> <ShowResultTypePicker xmlns="urn:schemas-microsoft-com:AdvancedSearchBox">true</ShowResultTypePicker> <ShowPropertiesSection xmlns="urn:schemas-microsoft-com:AdvancedSearchBox">true</ShowPropertiesSection> <PropertiesSectionLabelText xmlns="urn:schemas-microsoft-com:AdvancedSearchBox">$Resources:Microsoft.Office.Server.Search,AdvancedSearch_AddPropRestrictions_Title;</PropertiesSectionLabelText> </WebPart> ]]> </AllUsersWebPart> </File>
3. Customize your SharePoint advanced Search Page by modifying the Advanced Search Box and Export the webpart and copy the webpart file to the elements under module.

4. Export the web part and copy the content of the web part file to the elements.xml in the module.

<File Path="AdvancedSearchPage\advanced.aspx" Url="employeeAdvanced.aspx" Type="GhostableInLibrary"> <Property Name="PublishingPageLayout" Value="~SiteCollection/_catalogs/masterpage/AdvancedSearchLayout.aspx, $Resources:Microsoft.Office.Server.Search,SearchCenterAdvancedSearchTitle;" /> <Property Name="Title" Value="$Resources:Microsoft.Office.Server.Search,Search_Advanced_Page_Title;" /> <Property Name="ContentType" Value="$Resources:Microsoft.Office.Server.Search,contenttype_welcomepage_name;" /> <AllUsersWebPart WebPartZoneID="MainZone" WebPartOrder="1"> <![CDATA[ <WebPart xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/WebPart/v2"> <Title>Advanced Search Box</Title> <FrameType>None</FrameType> <Description>Displays parameterized search options based on properties and combinations of words.</Description> <IsIncluded>true</IsIncluded> <ZoneID>MainZone</ZoneID> <PartOrder>1</PartOrder> <FrameState>Normal</FrameState> <Height /> <Width /> <AllowRemove>true</AllowRemove> <AllowZoneChange>true</AllowZoneChange> <AllowMinimize>true</AllowMinimize> <AllowConnect>true</AllowConnect> <AllowEdit>true</AllowEdit> <AllowHide>true</AllowHide> <IsVisible>true</IsVisible> <DetailLink /> <HelpLink /> <HelpMode>Modeless</HelpMode> <Dir>Default</Dir> <PartImageSmall /> <MissingAssembly>Cannot import this Web Part.</MissingAssembly> <PartImageLarge /> <IsIncludedFilter /> <Assembly>Microsoft.Office.Server.Search, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c</Assembly> <TypeName>Microsoft.Office.Server.Search.WebControls.AdvancedSearchBox</TypeName> <SearchResultPageURL xmlns="urn:schemas-microsoft-com:AdvancedSearchBox">results.aspx</SearchResultPageURL> <TextQuerySectionLabelText xmlns="urn:schemas-microsoft-com:AdvancedSearchBox">Find documents that have...</TextQuerySectionLabelText> <ShowAndQueryTextBox xmlns="urn:schemas-microsoft-com:AdvancedSearchBox">true</ShowAndQueryTextBox> <AndQueryTextBoxLabelText xmlns="urn:schemas-microsoft-com:AdvancedSearchBox" /> <ShowPhraseQueryTextBox xmlns="urn:schemas-microsoft-com:AdvancedSearchBox">true</ShowPhraseQueryTextBox> <PhraseQueryTextBoxLabelText xmlns="urn:schemas-microsoft-com:AdvancedSearchBox" /> <ShowOrQueryTextBox xmlns="urn:schemas-microsoft-com:AdvancedSearchBox">true</ShowOrQueryTextBox> <OrQueryTextBoxLabelText xmlns="urn:schemas-microsoft-com:AdvancedSearchBox" /> <ShowNotQueryTextBox xmlns="urn:schemas-microsoft-com:AdvancedSearchBox">true</ShowNotQueryTextBox> <NotQueryTextBoxLabelText xmlns="urn:schemas-microsoft-com:AdvancedSearchBox" /> <ScopeSectionLabelText xmlns="urn:schemas-microsoft-com:AdvancedSearchBox">Narrow the search...</ScopeSectionLabelText> <ShowScopes xmlns="urn:schemas-microsoft-com:AdvancedSearchBox">false</ShowScopes> <ScopeLabelText xmlns="urn:schemas-microsoft-com:AdvancedSearchBox" /> <DisplayGroup xmlns="urn:schemas-microsoft-com:AdvancedSearchBox">Advanced Search</DisplayGroup> <ShowLanguageOptions xmlns="urn:schemas-microsoft-com:AdvancedSearchBox">false</ShowLanguageOptions> <LanguagesLabelText xmlns="urn:schemas-microsoft-com:AdvancedSearchBox" /> <ShowResultTypePicker xmlns="urn:schemas-microsoft-com:AdvancedSearchBox">true</ShowResultTypePicker> <ResultTypeLabelText xmlns="urn:schemas-microsoft-com:AdvancedSearchBox" /> <ShowPropertiesSection xmlns="urn:schemas-microsoft-com:AdvancedSearchBox">true</ShowPropertiesSection> <PropertiesSectionLabelText xmlns="urn:schemas-microsoft-com:AdvancedSearchBox">Add property restrictions...</PropertiesSectionLabelText> <Properties xmlns="urn:schemas-microsoft-com:AdvancedSearchBox"><root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <LangDefs> <LangDef DisplayName="Arabic" LangID="ar"/> <LangDef DisplayName="Bengali" LangID="bn"/> <LangDef DisplayName="Bulgarian" LangID="bg"/> <LangDef DisplayName="Catalan" LangID="ca"/> <LangDef DisplayName="Simplified Chinese" LangID="zh-cn"/> <LangDef DisplayName="Traditional Chinese" LangID="zh-tw"/> <LangDef DisplayName="Croatian" LangID="hr"/> <LangDef DisplayName="Czech" LangID="cs"/> <LangDef DisplayName="Danish" LangID="da"/> <LangDef DisplayName="Dutch" LangID="nl"/> <LangDef DisplayName="English" LangID="en"/> <LangDef DisplayName="Finnish" LangID="fi"/> <LangDef DisplayName="French" LangID="fr"/> <LangDef DisplayName="German" LangID="de"/> <LangDef DisplayName="Greek" LangID="el"/> <LangDef DisplayName="Gujarati" LangID="gu"/> <LangDef DisplayName="Hebrew" LangID="he"/> <LangDef DisplayName="Hindi" LangID="hi"/> <LangDef DisplayName="Hungarian" LangID="hu"/> <LangDef DisplayName="Icelandic" LangID="is"/> <LangDef DisplayName="Indonesian" LangID="id"/> <LangDef DisplayName="Italian" LangID="it"/> <LangDef DisplayName="Japanese" LangID="ja"/> <LangDef DisplayName="Kannada" LangID="kn"/> <LangDef DisplayName="Korean" LangID="ko"/> <LangDef DisplayName="Latvian" LangID="lv"/> <LangDef DisplayName="Lithuanian" LangID="lt"/> <LangDef DisplayName="Malay" LangID="ms"/> <LangDef DisplayName="Malayalam" LangID="ml"/> <LangDef DisplayName="Marathi" LangID="mr"/> <LangDef DisplayName="Norwegian" LangID="no"/> <LangDef DisplayName="Polish" LangID="pl"/> <LangDef DisplayName="Portuguese" LangID="pt"/> <LangDef DisplayName="Punjabi" LangID="pa"/> <LangDef DisplayName="Romanian" LangID="ro"/> <LangDef DisplayName="Russian" LangID="ru"/> <LangDef DisplayName="Slovak" LangID="sk"/> <LangDef DisplayName="Slovenian" LangID="sl"/> <LangDef DisplayName="Spanish" LangID="es"/> <LangDef DisplayName="Swedish" LangID="sv"/> <LangDef DisplayName="Tamil" LangID="ta"/> <LangDef DisplayName="Telugu" LangID="te"/> <LangDef DisplayName="Thai" LangID="th"/> <LangDef DisplayName="Turkish" LangID="tr"/> <LangDef DisplayName="Ukrainian" LangID="uk"/> <LangDef DisplayName="Urdu" LangID="ur"/> <LangDef DisplayName="Vietnamese" LangID="vi"/> </LangDefs> <Languages> <Language LangRef="en"/> <Language LangRef="fr"/> <Language LangRef="de"/> <Language LangRef="ja"/> <Language LangRef="zh-cn"/> <Language LangRef="es"/> <Language LangRef="zh-tw"/> </Languages> <PropertyDefs> <PropertyDef Name="Path" DataType="url" DisplayName="URL"/> <PropertyDef Name="Size" DataType="integer" DisplayName="Size (bytes)"/> <PropertyDef Name="Write" DataType="datetime" DisplayName="Last Modified Date"/> <PropertyDef Name="FileName" DataType="text" DisplayName="Name"/> <PropertyDef Name="Description" DataType="text" DisplayName="Description"/> <PropertyDef Name="Title" DataType="text" DisplayName="Title"/> <PropertyDef Name="Author" DataType="text" DisplayName="Author"/> <PropertyDef Name="DocSubject" DataType="text" DisplayName="Subject"/> <PropertyDef Name="DocKeywords" DataType="text" DisplayName="Keywords"/> <PropertyDef Name="DocComments" DataType="text" DisplayName="Comments"/> <PropertyDef Name="CreatedBy" DataType="text" DisplayName="Created By"/> <PropertyDef Name="ModifiedBy" DataType="text" DisplayName="Last Modified By"/> <PropertyDef Name="EmployeeNumber" DataType="text" DisplayName="EmployeeNumber"/> <PropertyDef Name="EmployeeId" DataType="text" DisplayName="EmployeeId"/> <PropertyDef Name="EmployeeFirstName" DataType="text" DisplayName="EmployeeFirstName"/> <PropertyDef Name="EmployeeLastName" DataType="text" DisplayName="EmployeeLastName"/> </PropertyDefs> <ResultTypes> <ResultType DisplayName="Employee Document" Name="default"> <KeywordQuery/> <PropertyRef Name="EmployeeNumber" /> <PropertyRef Name="EmployeeId" /> <PropertyRef Name="EmployeeFirstName" /> <PropertyRef Name="EmployeeLastName" /> </ResultType> <ResultType DisplayName="All Results"> <KeywordQuery/> <PropertyRef Name="Author" /> <PropertyRef Name="Description" /> <PropertyRef Name="FileName" /> <PropertyRef Name="Size" /> <PropertyRef Name="Path" /> <PropertyRef Name="Write" /> <PropertyRef Name="CreatedBy" /> <PropertyRef Name="ModifiedBy" /> </ResultType> <ResultType DisplayName="Documents" Name="documents"> <KeywordQuery>IsDocument="True"</KeywordQuery> <PropertyRef Name="Author" /> <PropertyRef Name="DocComments"/> <PropertyRef Name="Description" /> <PropertyRef Name="DocKeywords"/> <PropertyRef Name="FileName" /> <PropertyRef Name="Size" /> <PropertyRef Name="DocSubject"/> <PropertyRef Name="Path" /> <PropertyRef Name="Write" /> <PropertyRef Name="CreatedBy" /> <PropertyRef Name="ModifiedBy" /> <PropertyRef Name="Title"/> </ResultType> <ResultType DisplayName="Word Documents" Name="worddocuments"> <KeywordQuery>FileExtension="doc" OR FileExtension="docx" OR FileExtension="dot" OR FileExtension="docm" OR FileExtension="odt"</KeywordQuery> <PropertyRef Name="Author" /> <PropertyRef Name="DocComments"/> <PropertyRef Name="Description" /> <PropertyRef Name="DocKeywords"/> <PropertyRef Name="FileName" /> <PropertyRef Name="Size" /> <PropertyRef Name="DocSubject"/> <PropertyRef Name="Path" /> <PropertyRef Name="Write" /> <PropertyRef Name="CreatedBy" /> <PropertyRef Name="ModifiedBy" /> <PropertyRef Name="Title"/> </ResultType> <ResultType DisplayName="Excel Documents" Name="exceldocuments"> <KeywordQuery>FileExtension="xls" OR FileExtension="xlsx" OR FileExtension="xlsm" OR FileExtension="xlsb" OR FileExtension="ods"</KeywordQuery> <PropertyRef Name="Author" /> <PropertyRef Name="DocComments"/> <PropertyRef Name="Description" /> <PropertyRef Name="DocKeywords"/> <PropertyRef Name="FileName" /> <PropertyRef Name="Size" /> <PropertyRef Name="DocSubject"/> <PropertyRef Name="Path" /> <PropertyRef Name="Write" /> <PropertyRef Name="CreatedBy" /> <PropertyRef Name="ModifiedBy" /> <PropertyRef Name="Title"/> </ResultType> <ResultType DisplayName="PowerPoint Presentations" Name="presentations"> <KeywordQuery>FileExtension="ppt" OR FileExtension="pptx" OR FileExtension="pptm" OR FileExtension="odp"</KeywordQuery> <PropertyRef Name="Author" /> <PropertyRef Name="DocComments"/> <PropertyRef Name="Description" /> <PropertyRef Name="DocKeywords"/> <PropertyRef Name="FileName" /> <PropertyRef Name="Size" /> <PropertyRef Name="DocSubject"/> <PropertyRef Name="Path" /> <PropertyRef Name="Write" /> <PropertyRef Name="CreatedBy" /> <PropertyRef Name="ModifiedBy" /> <PropertyRef Name="Title"/> </ResultType> </ResultTypes></root></Properties> </WebPart> ]]> </AllUsersWebPart> </File>
5.Deploy your custom solution and you will have a custom advanced search page.
How to create managed properties at site collection level in SharePoint2013
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
New-SPEnterpriseSearchMetadataCrawledProperty
New-SPEnterpriseSearchMetadataManagedProperty
Remove-SPEnterpriseSearchMetadataManagedProperty
Overview of crawled and managed properties in SharePoint 2013 Preview
How to use SharePoint modal dialog box to display Custom Page Part2
In the first part of the series, I showed you how to display and close a custom page in a SharePoint modal dialog using JavaScript. In this one, I’d like to show you how to display some information after the Modal dialog is closed.You can download the source code here.
1. Firstly, modify the element file as follow
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<CustomAction Id="ReportConcern"
RegistrationType="ContentType"
RegistrationId="0x010100866B1423D33DDA4CA1A4639B54DD4642"
Location="EditControlBlock"
Sequence="107"
Title="Display Custom Page"
Description="To Display Custom Page in a modal dialog box on this item">
<UrlAction Url="javascript:
function emitStatus(messageToDisplay) {
statusId = SP.UI.Status.addStatus(messageToDisplay.message + ' ' +messageToDisplay.location );
SP.UI.Status.setStatusPriColor(statusId, 'Green');
}
function portalModalDialogClosedCallback(result, value) {
if (value !== null) {
emitStatus(value);
}
}
var options = {
url: '{SiteUrl}' + '/_layouts/YBBEST/TitleRename.aspx?List={ListId}&ID={ItemId}',
title: 'Rename title',
allowMaximize: false,
showClose: true,
width: 500,
height: 300,
dialogReturnValueCallback: portalModalDialogClosedCallback };
SP.UI.ModalDialog.showModalDialog(options);" />
</CustomAction>
</Elements>
2. In your code behind, you can implement a close dialog function as below. This will close your modal dialog box once the button is clicked and display a status bar.
protected static string GetCloseDialogScript(string message)
{
var scriptBuilder = new StringBuilder();
scriptBuilder.Append("<script type='text/javascript'>" + "SP.UI.ModalDialog.commonModalDialogClose(1,").Append(message).Append("); </script>");
return scriptBuilder.ToString();
}
How to write PowerShell code part 3 (calling external script)
In this post, I’d like to show you how to calling external script from a PowerShell script. I’d like to use the site creation script as an example. You can download script here.
1. To call the external script, you need to first to grab the script path. You can do so by calling $scriptPath = Split-Path $myInvocation.MyCommand.Path to grab the current script path. You can then use this to build the path for your external script path.
$scriptPath = Split-Path $myInvocation.MyCommand.Path $ExternalScript=$scriptPath+"\CreateSiteCollection.ps1" $configurationXmlPath=$scriptPath+"\SiteCollection.xml" [xml] $configurationXml=Get-Content $configurationXmlPath & "$ExternalScript" $configurationXml Write-Host
2.If you like to pass in any parameters , you need to define your script parameters in param () at the top of the script and separate each parameter by a comma (,) and when calling the method you do not need comma (,) to separate each parameter.
#Pass in the Parameters. param ([xml] $xmlinput)
Javascript Tips and Tricks
1. Replace all , in one Javascript string.
var totalAmount= "100,000,000,000"; var find= ","; //Replace the first , with the empty string var replace=""; totalAmount= totalAmount.replace(find,replace); alert(totalAmount); var totalAmount2= "100,000,000,000"; var newFind=/,/g //Replace all , with empty string totalAmount2= totalAmount2.replace(newFind,replace); alert(totalAmount2);
Useful links for InfoPath form development
Powershell
http://msdn.microsoft.com/en-us/library/ms442691.aspx
http://technet.microsoft.com/en-us/library/ee806878.aspx
http://sharepoint.microsoft.com/blogs/zach/Lists/Posts/Post.aspx?ID=7
InfoPath
http://msdn.microsoft.com/en-us/library/aa943232.aspx
http://jopx.blogspot.com/2006/08/infopath-2007-solving-xsn-can-not-be.html



