Skip to main content

Posts

SharePoint 2013 CAML Query Errors

I got this error while running a CAML Query from a SharePoint 2013 Client application: System.ArgumentException: Value does not fall within the expected range. This was happening only in the Prod environment. One thing that needs to be checked is that in Central Administration > Resource Throttling > List View Lookup Threshold is high enough for all lookup fields in your query:

SPWeb.ParserEnabled property

When set to TRUE : when a document is added to a document library, the values of the fields in the list item for the document are added to the metadata properties of the document file.  when you download and upload it again these properties are kept  When set to FALSE : all of the above is ignored - no custom metadata properties from the library is added to the document when added or uploaded.  the issue comes if you are using sandbox solutions - nothing works anymore since none of the solution properties of the package are set and thus you cannot activate / upgrade any solution.

Powershell: Delete Taxonomy Term

Delete a Term in a TermStore using PowerShell: function Delete -SP Term ( $SiteUrl , $TermStoreName , $TermName ) { Start - SPAssignment - Global try { $site = Get - SPSite $SiteUrl $session = new - object Microsoft . SharePoint . Taxonomy . TaxonomySession ( $site ) $termstore = $session . TermStores [ $termStoreName ] $terms = $termstore . GetTerms ( $termName , $false ) if ( $terms . Count - gt 0 ){ $terms [ 0 ]. Delete () $termstore . CommitAll () Write - Host 'Term deleted!' } else { Write - Host 'Term not found!' } } finally { Stop - SPAssignment - Global } } Use example: Delete - GroupTerm - SiteUrl " " - TermStoreName " " - TermName " "

SharePoint 2010 State Machine Workflow error: "Failed to Start Workflow"

I've been working on a custom state machine workflow for a specific content type. I've associated the workflow to the content type like this: < AssociationCategories > ContentType ; 0x01........ </ AssociationCategories > This workflow has a custom initiation form, in which I'm passing some options to the workflow. After doing the association to the content type I started getting the following error: "Failed to Start Workflow" After doing a bit of debugging and head scratching I found that in the  StartListWorkflow () method inside the initiation page in which the workflow association is retrieved from the workflowList.WorkflowAssociations list and it does not take into consideration the ContentType workflow associations. private void StartListWorkflow () { SPWorkflowAssociation association = this . workflowList . WorkflowAssociations [ new Guid ( this . associationGuid )]; this . Web . Site . WorkflowManager . StartWork...

SharePoint 2010 - Enable and configure unique Document IDs

There is a great article on how to Enable and configure unique Document IDs on Microsoft.com. In short you need to: Activate the Document ID site collection feature Enable and configure the use of Document IDs in a site collection But what it doesn't mention is that behind the scenes there are two time jobs that need to run to activate this feature: one to add the Document ID column and one to generate unique ids for the existing documents. But, these jobs are set to run once a day. So if you need your unique Document IDs to be activate right away, you need to go to Central Administration and run these two timer jobs for your respective web application: Document ID enable/disable job  Document ID assignment job 

System.InvalidOperationException: The event receiver context for Workflow is invalid.

Ever got this error while developing SharePoint 2010 Workflows in Visual Studio? System.InvalidOperationException: The event receiver context for Workflow is invalid. at Microsoft.SharePoint.SPEventReceiverDefinition.ValidContext() at Microsoft.SharePoint.SPEventReceiverDefinition.GetSqlCommandToAddEventReceivers(IList`1 erds) at Microsoft.SharePoint.Workflow.SPWinOESubscriptionService.CommitNewSubscriptions(Transaction txn, IList`1 erds) Check the you have set the all the TaskIds in your code: TaskId = Guid.NewGuid(); If this is not the case need to check that your Correlation Tokens are setup correctly.