Posted on:
Categories: SharePoint
Description:
​Symptoms You publish a workflow using SharePoint Designer 2010. When you attempt to run the workflow you see the following error “The form cannot be submitted because of an error” Cause This appears to be due to a recent Microsoft Office Security update (KB2553322). Solution Remove InfoPath Update KB2553322 (http//myquestforpassion.wordpress.com/2012/08/29/sharepoint-workflow-associationinitiation-form-error/). This step alone did not solve my issue. I had to proceed to the following steps.Republish the workflow as followsOpen the Workflow in SharePoint DesignerIn the Ribbon click Initiation Form ParametersClick OK without changing anythingRepublish the workflow; you may see a warning indicating that the workflow has been customized.Save and Publish the FormPublish the Workflow




Posted on:
Categories: SharePoint
Description: Use ScriptLink and CssRegistration in web parts and web controls to include files.
​Outside of SharePoint, if we want to include a JavaScript file in a web control, we would normally do something like if (!Page.ClientScriptManager.IsClientScriptIncludeRegistered(typeof(Page), includeKey)) Page.ClientScriptManager.RegisterClientScriptInclude(typeof(Page), includeKey, scriptUrl) For CSS, I would normally do something like bool controlAdded = false; foreach (Control c in Page.Header.Controls) if (c.ID == "TestCssLink") controlAdded = true; if (!controlAdded) var css = new System.Web.UI.HtmlControls.HtmlLink ID = "TestCssLink", Href = cssUrl ; css.Attributes.Add("rel", "stylesheet"); css.Attributes.Add("type", "text/css"); Page.Header.Controls.Add(css); Within SharePoint, you could include JavaScript and CSS files in your masterpage or page layouts and call it a day. However if you would like to make the page load leaner and the components more modular, I could still include them when and where I need them by doing the same described above or better, use ScriptLink and CssRegistration as below protected override void CreateChildControls() base.CreateChildControls(); var scriptLink = new ScriptLink Name = scriptUrl, Language = "javascript", Localizable = false ; base.Controls.Add(scriptLink); var css = new CssRegistration Name = cssUrl, After = "Themable/corev15.css" ; base.Controls.Add(css);




Posted on:
Categories: SharePoint
Description: ​There are times when I provision a search results web part in a custom site template and need to configure the query programmatically as it changes on a per site basis.
​There are times when I provision a search results web part in a custom site template and need to configure the query programmatically as it changes on a per site basis. The following outlines how I usually go about doing it. 1) In your test site, manually add a Search Results web part to a test page. 2) Manually configure all the web part properties you need including the query. 3) Export the web part to a .webpart file. 4) For best practices, creation of pages including default.aspx should be done in a module outside the custom site template's onet.xml file. In Visual Studio within the module where you provision the page to contain the web part, add an AllUsersWebPart and copy and paste the .webpart file content to it. For example <Module Name="Home" Url="$Resourcesosrvcore,List_Pages_UrlName;"><File Url="default.aspx" Type="GhostableInLibrary" Level="Published" Path="PagesModule\default.aspx" > <Property Name="Title" Value="$Resourcescmscore,IPPT_HomeWelcomePage_Title;" /> <Property Name="PublishingPageLayout" Value="~SiteCollection/_catalogs/masterpage/WelcomeLinks.aspx, $Resourcescmscore,PageLayout_WelcomeLinks_Title;" /> <Property Name="ContentType" Value="$Resourcescmscore,contenttype_welcomepage_name;" /> <AllUsersWebPart WebPartZoneID="MainZone" WebPartOrder="1"> <![CDATA[ <webParts> <webPart xmlns="http//schemas.microsoft.com/WebPart/v3"> <metaData> <type name="Microsoft.Office.Server.Search.WebControls.ResultScriptWebPart, Microsoft.Office.Server.Search, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" /> <importErrorMessage>Cannot import this Web Part.</importErrorMessage> </metaData> <data> <properties> ... ... </properties> </data> </webPart> </webParts> ]]> </AllUsersWebPart></File></Module> 5) You would now need a feature receiver to configure the query. Within the feature receiver FeatureActivated event, create a DataProviderScriptWebPart object and set the DataProviderJSON property to the value of the same property from the Search Result web part. Override the QueryTemplate property value, or any other property values like SourceName, SourceID etc. if so desired. For example private void ConfigureSearchResultsWebPart(SPFile pageFile) using (var lwpm = pageFile.GetLimitedWebPartManager(PersonalizationScope.Shared)) var webParts = lwpm.WebParts; var resultScriptWebPart = webParts.Cast() .FirstOrDefault( wp => wp is ResultScriptWebPart) as ResultScriptWebPart; if (resultScriptWebPart == null) return; var querySettings = new DataProviderScriptWebPart PropertiesJson = resultScriptWebPart.DataProviderJSON ; querySettings.Properties["QueryTemplate"] = String.Format("path\"0\" IsDocument\"True\"", pageFile.Web.Url); resultScriptWebPart.DataProviderJSON = querySettings.PropertiesJson; lwpm.SaveChanges(resultScriptWebPart);




Posted on:
Categories: SharePoint
Description:
​SymptomsA SharePoint 2013 platform workflow is associated with a document library. The workflow is configured to fetch data from a lookup column for the current item and store it in a variable. When the workflow runs it is results in a cancelled state. The following error is logged in the workflow history RequestorId d75940f0-4635-2143-388d-cf1483a55983. Details System.ApplicationException HTTP 404 "error""code""-2130575322, Microsoft.SharePoint.SPException","message""lang""en-US","value""List does not exist.\u000a\u000aThe page you selected contains a list that does not exist. It may have been deleted by another user." "Transfer-Encoding"["chunked"],"X-SharePointHealthScore"["0"],"SPClientServiceRequestDuration"["16"],"SPRequestGuid"["ffc4a952-de67-4416-bde3-c5964cfac04e"],"request-id"["ffc4a952-de67-4416-bde3-c5964cfac04e"],"X-FRAME-OPTIONS"["SAMEORIGIN"],"MicrosoftSharePointTeamServices"["15.0.0.4481"],"X-Content-Type-Options"["nosniff"],"X-MS-InvokeApp"["1; RequireReadOnly"],"Cache-Control"["max-age=0, private"],"Date"["Fri, 28 Mar 2014 163855 GMT"],"Server"["Microsoft-IIS\/8.0"],"X-AspNet-Version"["4.0.30319"],"X-Powered-By"["ASP.NET"] at Microsoft.Activities.Hosting.Runtime.Subroutine.SubroutineChild.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) Cause The error message above indicates that the workflow was not able to find the list that is configured for the lookup field. My research indicates that lookup fields are not supported for SharePoint 2013 platform type workflows http//office.microsoft.com/en-ca/help/sharepoint-server-2013-known-issues-HA102919021.aspx Workaround Microsoft recommends two workarounds. Use Call HTTP Web Service action. For example http//site_name/_api/Web/Lists/GetByTitle('list_name')/Items(item_ID)/FieldValuesAsText?$select=field_name where field_name is the EntityPropertyName property of SPField objectCall SharePoint 2010 workflows using Start List/Site Workflow action. In my case, I went with the option of calling a SharePoint 2010 platform type workflow from within the 2013 workflow. The 2010 workflow step consists in fetching the desired value from the lookup field, which can then be retrieved at a later step in the 2013 workflow. This resolved the issue.




Posted on:
Categories: SharePoint
Description:
Symptoms You have a SharePoint 2013 platform type workflow that is associated with a Document Library. When the workflow runs it appears as cancelled. You may see an error in the workflow status page similar to the following RequestorId d75940f0-4635-2143-388d-cf1483a55983. Details System.ApplicationException HTTP 500 "Transfer-Encoding"["chunked"],"X-SharePointHealthScore"["0"],"SPClientServiceRequestDuration"["64"],"SPRequestGuid"["b82a35c8-0da1-45d8-96a8-ea3b2e32a149"],"request-id"["b82a35c8-0da1-45d8-96a8-ea3b2e32a149"],"X-FRAME-OPTIONS"["SAMEORIGIN"],"MicrosoftSharePointTeamServices"["15.0.0.4481"],"X-Content-Type-Options"["nosniff"],"X-MS-InvokeApp"["1; RequireReadOnly"],"Cache-Control"["max-age=0, private"],"Date"["Thu, 27 Mar 2014 210153 GMT"],"Server"["Microsoft-IIS\/8.0"],"X-AspNet-Version"["4.0.30319"],"X-Powered-By"["ASP.NET"] at Microsoft.Activities.Hosting.Runtime.Subroutine.SubroutineChild.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) The error message above contains an SPRequestGuid which can be matched to a correlation ID in the ULS logs. The error message indicates the following “The file "http//sharepointsite/sites/site/test.txt" is not checked out. You must first check out this document before making changes.” Cause The document library is set to require check out In SharePoint 2013, when a workflow is associated with a list or a content type, a new column is added to track the status of the workflow. This workflow status column is updated automatically with a description of the stage of the workflow that is currently being executed. The important point to consider is that when the workflow runs, and before it has executed any of its actions, it will attempt to update the workflow status field for the item that triggered the workflow. Since the document needs to be checked out before any changes can be made to it the workflow will fail. This is important becuase it means that you cannot try to workaround this issue by configuring your workflow to check out the document before it attempts to update the workflow status field. As already mentioned, the workflow will attempt to update the workflow status field before any of the workflow's actions are executed. Therefore, you will have to use another workaround if you want your workflow to succeed. Workarounds Disable ‘Require Check Out’. This option is not going to be viable if there is already a business case to require check out.In SharePoint Designer remove the option to update the workflow status. Now, since the workflow does not need to update the item, you will no longer encounter the issue outlined above. You can refer to this blog post for further information about this workaround http//www.cleverworkarounds.com/category/sharepoint-2013/page/2/




Posted on:
Categories: SharePoint
Description:
Symptoms You have 2 SharePoint lists (List A and List B). You have a SharePoint 2010 workflow associated with List A which copies newly created list items to List B. List B is associated with a SharePoint 2013 platform type workflow that is configured to start when new items are added. However, when the workflow from List A copies the newly created item to List B, the List B workflow does not start automatically. There are no errors in the workflow history or in the ULS logs. The workflow in List B will work correctly if you start it manually. Cause Unknown. From what I’ve read online there are quite a few people who are reporting the same issue. Most forum posts end without any definite resolution. Workaround Recreate the 2013 workflow in SharePoint Designer using the SharePoint 2010 platform type. In the case that I was working on the workflow did not rely on any features that are specific to the 2013 platform type, so there was no loss of functionality.