Wednesday, October 29, 2014

Infopath Error: The Query cannot run, Infopath cannot run the specified query. Access denied.

 Creating a InfoPath form for a document library in one of my project, publish the infopath form I got an error saying that “InfoPath cannot run the specified query. Access is denied”.
I have verified few blog posts and verified following options,
  • Permissions to document library and site – Yes iam having Full Control over site and Document library
  • Domain – Yes iam in VPN with the same network

But User cannot submit a form to SharePoint if the security level is ‘Restricted’ . We need to have Domain Trust should be Full Control or more.
To grant Full control we have to follow the steps below,
In the InfoPath File Click on “Form Options” as shown the image below,

In Form Option popup, Security and Trust, Select “Full Trust” on security level as shown the image below.

Click on Ok to save the settings. Now we can publish the InfoPath form with out errors. 

Sunday, October 12, 2014

SharePoint Quick tip - Get SharePoint list item display form details through code

We can get display form URL by appending “DispForm.aspx?ID=” with the URL by adding ID values at the end. We can get the form details byusing list item properties as shown the code below

using (SPSite currentSite = new SPSite(SiteURL))
    using (SPWeb currentWeb = currentSite.OpenWeb())
        SPList currentList = currentWeb.Lists[
List Name];
        SPListItem currentListItem = currentList.Items[
        string displayForm= String.Concat(currentListItem.Web.Url, "/", currentListItem.ParentList.Forms[PAGETYPE.PAGE_DISPLAYFORM].Url, "?id=", currentListItem.ID.ToString());

Hope this helps.

Saturday, October 4, 2014

SharePoint 2010 workflow error – “Due to heavy load, the latest workflow operation has been queued”

While working with custom workflows in SharePoint 2010, I got error in workflow as “Due to heavy load, the latest workflow operation has been queued”. After refreshing the page, most of the times error may fixed and workflow completed as usual. Sometimes I used to stuck on the workflow and I can see only the non-reactive screen with the error. I didn’t event fix the error after resetting the workflow and IIS Manager. After digging for the solution finally I got a fix for the error by updating the Workflow Postpone threshold in farm config manager by using following PowerShell commands,

Set-SpFarmConfig -WorkflowPostponeThreshold 30

By running the command, workflow threshold will be increased from 15 to 30

get-sptimerjob | ?{$ -like "job-workflow"} | set-sptimerjob -schedule "every 1 minutes between 0 and 59"

By running this command frequency of execution for SP timer job, job-workflow will be increased to every minute. After running the commands, if workflow don’t have any issues will be completed as expected.