Posts

The form cannot be rendered. This may be due to a misconfiguration of the Microsoft SharePoint Server State Service. For more information, contact your server administrator

Hi there, I was having a requirement to create SharePoint 2013 approval workflow using 2010 template. workflow was attached to content type. Issue I was facing, while going to start the workflow it gives error of " The form cannot be rendered. This may be due to a misconfiguration of the Microsoft SharePoint Server State Service. For more information, contact your server administrator" After some research came to find the solution,  this is related to state service as mentioned in error above. Paste following commands in SharePoint management shell: $serviceApp = New-SPStateServiceApplication -Name "State Service" New-SPStateServiceDatabase -Name "StateServiceDatabase" -ServiceApplication $serviceApp New-SPStateServiceApplicationProxy -Name "State Service" -ServiceApplication $serviceApp -DefaultProxyGroup And now again I tried to start the workflow, and it started successfully!

SharePoint 2013 Workflow error : Custom outcome column returns default option as a task result

Image
I was facing weird issue in SharePoint 2013 Designer workflow. Scenario was, I wanted to create one list workflow where custom list was created programmatically and having my custom workflow task list created through code as well custom content type and outcome columns also created programmatically. Now in workflow stage having an Assign task action and in Outcome options using the above created content type and site columns, see the figure below: Issue here I was facing, Task result was always showing "TaskOutcome:0" i.e the default Outcome in task inspite of I selected any another option. example in above figure result was always coming "Action Plan Created". Tried different approaches to make it work: -While debugging tried various options to make it work, like installed update http://support.microsoft.com/kb/2767999 where it mentioned that "Assume that you use non-ASCII characters to name a task outcome field in a task in a cu...

Errors were found when compiling the workflow. The workflow files were saved but cannot run. - SharePoint 2013

Image
Today while trying to publish the workflow, came across the weird error "Errors were found when compiling the workflow. The workflow files were saved but cannot run." After digging into it, came to the solution that need to    Re-register service into my site using   following commands: Register-SPWorkflowService -SPSite 'https://my-host/mysite' -WorkflowHostUri 'https://workflowhost' -AllowOAuthHttp -Force I reopened SharePoint Designer again and problem disappeared. Hope this will save your time.

Powershell To Attach workflow on Content Type and create Retention Policy on it - SharePoint 2013

Hi Friends, I got a requirement to create retention policy on Content type and action is to start workflow. as well attach workflow to the content type. I choose to go with powershell. save the following code into file called SetupRetentionPolicy.ps1 call like: c:\>.\SetupRetentionPolicy.ps1 -url <weburl> -ContentTypeName <Contenttype> param( $url=$null, $ContentTypeName=$null) $site = get-spsite $url $web = $site.openweb() Enable-SPFeature –identity "LocationBasedPolicy" -URL $url -ErrorAction SilentlyContinue $Property = "Modified" $Period = 1; $PeriodType = "years" function AddWorkflowToContentType($site, $ctName, $WfName, $WfAssociationName, $TaxTaskList) { [void][System.Reflection.Assembly]::LoadWithPartialName('Microsoft.SharePoint') [void][System.Reflection.Assembly]::LoadWithPartialName('Microsoft.Office.Policy') [Guid]$wfTemplateId = New-Object Gui...

How to: Follow documents and sites by using the .NET JavaScript object model in SharePoint 2013

Scenario is here we will create one sample user control, which will have simple one star which we can place on our page to follow the site/documents using JavaScript object model. 1. Visual Studio 2012, SharePoint project. 2. Add new item, web user control and give a name : favoriteControl.ascx 3. <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="FavoriteControl.ascx.cs" Inherits="test.FavoriteControl" %> <div class="favIcon" runat="server" id="favoriteLink"><a href="#" runat="server" id="favorite" onclick="javascript:Follow();"></a></div> 4. Add Script file to project, named favoritehelper.js and paste the following code: $(document).ready(function () { // Ensure that the SP.UserProfiles.js file is loaded before the custom code runs. //SP.SOD.executeOrDelayUntilScriptLoaded(loadUserData, 'sp.userprofiles...

SharePoint 2013 Workflow gets canceled automatically

Hi, I was struck with the error of Workflow gets canceled automatically. Scenario was : A new SP 2013 installation, one server with SP, WF, etc and the other is simply SQL Server. Went through the installation steps for Workflow including the powershell bits. In designer, I am able to create a simple workflow and select 2013 as the type. When the workflow is run, is shows internal status is canceled and has the following error text below. RequestorId: 55c6990b-c4a6-352c-4a5b-449fc1aecac4. Details: System.ApplicationException: HTTP 401 {"x-ms-diagnostics":["3001000;reason=\"There has been an error authenticating the request.\";category=\"invalid_client\""],"SPRequestGuid":["55c6990b-c4a6-352c-4a5b-449fc1aecac4"],"request-id":["55c6990b-c4a6-352c-4a5b-449fc1aecac4"],"X-FRAME-OPTIONS":["SAMEORIGIN"],"SPRequestDuration":["61"],"SPIisLatency":["1...

SharePoint 2013 Taxonomy import using .csv and Setting site navigation to use taxonomy using PowerShell

Image
Now requirement to import taxonomy from .csv file using PowerShell as well set taxonomy as site navigation with url. 1. Create .csv file 2. Create new script and paste below code. Param( [string] $siteUrl = $(throw "Error: Parameter siteUrl is required"), [boolean]$emptyfirst ) ##Variables that should not be edited $termsetName="My Navigation" function CreateTerm( $parent, $name, $url ) { Write-Host "Adding term $($parent.Name) -> $name" $term = $parent.CreateTerm("$name", 1033) $term.IsAvailableForTagging = $false $term.SetLocalCustomProperty("_Sys_Nav_ExcludedProviders", '"CurrentNavigationTaxonomyProvider"') $term.SetLocalCustomProperty("_Sys_Nav_SimpleLinkUrl", $url) #$term.SetLocalCustomProperty("tIME", $url) return $term } function GetTerm($termName, $parent) { $termName = [Microsoft.SharePoint.Taxonomy.TaxonomyI...

SharePoint 2013 TermSet with PowerShell

Create new script with following code: $session = Get - SPTaxonomySession - Site "Your site Url" $termStore = $session . TermStores [“ Managed Metadata Application ”] - change your managed metadata service name $group = $termstore . CreateGroup (“ My New Group ”) $group . Description = "My Term Group" $termStore . CommitAll () $termSet = $group . CreateTermSet (“ My TermSet ”, 1033 ) $termSet . Description = “ My TermSet ” $termSet . IsAvailableForTagging = $true $termSet . IsOpenForTermCreation = $true $termStore . CommitAll () To enable the term set for navigation, i.e    "Use this Term Set for Site Navigation"   use following code to make it enabled. $navigationSet = $group . CreateTermSet ( $termsetName ) $navigationSet . SetCustomProperty ( "_Sys_Nav_IsNavigationTermSet" , "True" ) $navigationSet . SetCustomProperty ( "_Sys_Nav_AttachedWeb_SiteId" , $site . ID . ToString ...

Remove sharepoint site and custom list from the search result

Image
Today, I came across the requirement where I have to stop site to be crawl in search Go to the  Site Actions=> Site Settings => Site Administration => Search and offline availability. We can manage the visibility of site and site's web page's web parts for search. Using SharePoint object model: Using Powershell: #---------StopSearch $site=Get-SPSite "http://servername:1111/" $web=$site.RootWeb; $web.AllowAutomaticASPXPageIndexing=$true $web.ASPXPageIndexMode=[Microsoft.SharePoint.WebASPXPageIndexMode]::Never $web.NoCrawl=$false $web.Update() #---------StartSearch $site=Get-SPSite "http://servername:1111/" $web=$site.RootWeb; $web.AllowAutomaticASPXPageIndexing=$false $web.ASPXPageIndexMode=[Microsoft.SharePoint.WebASPXPageIndexMode]::Never $web.NoCrawl=$true $web.Update() For SharePoint Custom list: Go to :  List Settings page, under  General Settings , click  Advanced settings . In the  Search  section, under  Allow items from...

Custom aspx page with default master page in SharePoint

I had a requirement to create custom aspx page and deploy to _layouts folder. Got help from this  http://www.codeproject.com/Tips/312544/How-To-Add-Custom-ASP-NET-Page-Using-Layouts-Folde Page is deployed to _layouts folder. Code in .aspx file <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ItemDetails.aspx.cs" Inherits="namespace,Version=1.0.0.0, Culture=neutral, PublicKeyToken=3ffee3a64ae3d939" Debug="true" MasterPageFile="~/_layouts/v4.master" %> <%@ Assembly Name="Microsoft.SharePoint.ApplicationPages,  Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <asp:Content ID="Content1" ContentPlaceHolderID="PlaceHolderMain" runat="server">    main file content </asp:Content> <asp:Content ID="PageTitle" ContentPlaceHolderID="PlaceHolderPageTitle" runat="server"> </asp:Content...