SharePoint on-line 2013 web service call to execute a CAML query against a list

Well, talk about a journey; If you will be doing any SharePoint on-line 2013 workflows, you are going to need to understand this.

These were my inspiration
Great tutorial
Great Fiddler reference

Without those two, I would still be there at Christmas.  This is my summary;

I am querying a list in a sub web called ‘Config’ for a list Called ConfigItems

First you need to grab the auth cookies, browse to

FIDDLER: Get ContextInfo to grab a form digest from: This is a GET”

User-Agent: Fiddler
Cookie: rtFa+sO9PIAAAAA==; FedAuth=77u/PD94bWwg==
Content-Type: application/json;odata=verbose;
Content-Length: 0
Accept: application/json;odata=verbose;

Now, examine the json, find formdigest
Add it to your headers as X-RequestDigest
X-RequestDigest: 0x445623A1758C83A5,25 Mar 2014 07:37:55 -0000
So now you have

User-Agent: Fiddler
Cookie: rtFa+sO9PIAAAAA==; FedAuth=77u/PD94bWwg==
Content-Type: application/json;odata=verbose;
Content-Length: 0
Accept: application/json;odata=verbose;
X-RequestDigest: 0x445623A1758C83A5,25 Mar 2014 07:37:55 -0000

Now you can call list api’s – Get all items from a sub web called Config USE A GET‘configitems’)/items”

or via CAML, this is a PUT‘configitems’)/GetItems(query=@v1)?@v1={“ViewXml”:”<View><Query><ViewFields><FieldRef%20Name=’Title’/><FieldRef%20Name=’ItemValue’/></ViewFields><Where><Eq><FieldRef%20Name=’ItemGroup’/><Value%20Type=’Choice’>SomeWorkflow</Value></Eq></Where></Query></View>”}



SharePoint on-line : simple 2013 workflow to send an email

Struggled for a while with this.

  • Download latest SharePoint designer 2013 (some early releases were buggy I am told)
  • Apply any SharePoint designer updates (Had an issue with designer not able to load visio)
  • Make sure the “Acount” Designer is using is your 0n-line account not your desktop account
  • Connect to an site collection (Not your admin site collection :-))
  • Enable site feature “Workflows can use app permissions”
  • Grant app permissions in your site collection see this (
  • Create a (in my case) site workflow
  • Add an app step
  • Inside the app step Include a send email action, send it to yourself
  • Publish the workflow
  • Go to site settings -> Site content -> site workflows
  • Execute your workflow
  • Check your inbox of the email address specified in your Profile

That’s all folks.


Search fix (Simple single server farm only)

I am constantly having issues with three things on SharePoint 2013 farms

  • Search
  • UP Synch
  • Managed metadata

So to search.  Often following a reboot the search admin screen will show one component or another in a non ideal state.  Red cross, Yellow warning triangle etc.

googling will show you many and various ways to fix some / all or none of these issues, re create index, flush SharePoint Caches, re provision Search host, and the list goes on and on and on…

For times when all these fail me, I have crafted this simple script to surgically take out a broken component and replace it with a shiney new one.  It is intended for single server with simple search topology and if you use it you are responsible for ensuring the code is fit for ‘your’ purpose.

I think the script is self explanatory.


param (
    $component # Crawl, Admin, Query, Content, Analytics, Index
# Grab the Search Service Instance
$Sinstance = Get-SPEnterpriseSearchServiceInstance -Identity $env:COMPUTERNAME
# Grab active topology
$ssa = Get-SPEnterpriseSearchServiceApplication
$active = Get-SPEnterpriseSearchTopology -SearchApplication $ssa -Active
# Create a clone of active to work with
$clone = New-SPEnterpriseSearchTopology -SearchApplication $ssa -Clone –SearchTopology $active
# grab component giving us trouble
$problem = Get-SPEnterpriseSearchComponent -SearchTopology $clone | ? {$_.Name -like "$component*"}
# Remove troublesome component from clone
if($problem.GetType().ToString() -eq "System.Object[]") {
    $problem | Remove-SPEnterpriseSearchComponent -Identity $_ -SearchTopology $clone -Confirm:$false
else {
    Remove-SPEnterpriseSearchComponent -Identity $problem -SearchTopology $clone -Confirm:$false
switch($component) {
    "Crawl" {
        New-SPEnterpriseSearchCrawlComponent -SearchTopology $clone -SearchServiceInstance $Sinstance
    "Admin" {
        New-SPEnterpriseSearchAdminComponent -SearchTopology $clone -SearchServiceInstance $Sinstance
    "Query" {
        New-SPEnterpriseSearchQueryProcessingComponent -SearchTopology $clone -SearchServiceInstance $Sinstance
    "Content" {
        New-SPEnterpriseSearchContentProcessingComponent  -SearchTopology $clone -SearchServiceInstance $Sinstance
    "Analytics" {
        New-SPEnterpriseSearchAnalyticsProcessingComponent  -SearchTopology $clone -SearchServiceInstance $Sinstance
    "Index" {
        New-SPEnterpriseSearchIndexComponent  -SearchTopology $clone -SearchServiceInstance $Sinstance    
    default {
        write-host "Dont understand" $component
# Make clone active
Set-SPEnterpriseSearchTopology -Identity $clone
# Clear out Inactive topologies
get-SPEnterpriseSearchTopology -SearchApplication $ssa | ? {$_.state -ine "Active" } | Remove-SPEnterpriseSearchTopology -Confirm:$false