QueryList Error handling

  • 18 February 2015
  • 3 replies
  • 23 views

Badge +6

Hi,

we have a UDA using Query list action based on a calculated url. If there is an issue calculating this url the UDA and the whole workflow fails with the following error: Failed to run User Defined Action. Invalid URI: The URI scheme is not valid.

I would like to catch this exception and perform some action indstead. Since ther is no error handling in the Query list action this is not possible directly. I think about using a regex to check URI format...

Best regards

Roman


3 replies

Userlevel 7
Badge +17

You can Query for items using the Call a Web Service action that has Error Handling. Do you think that could help? Use the Lists.asmx

Badge +6

Hi Andrew,

I think that could do it. I tried calling Lists.asmx method GetListItems but all I get is (500) internal Server Error. Do I have to encode the content?

Thanks

Roman

<?xml version="1.0" encoding="utf-8"?>

<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:m="http://schemas.microsoft.com/sharepoint/soap/">

  <soap:Header>

  </soap:Header>

  <soap:Body>

    <m:GetListItems>

      <m:listName>{79E5C191-5DC6-406F-9FF3-A4947C4C664D}</m:listName>

      <m:viewName>

      </m:viewName>

      <m:query>

<Query>

  <Where>

    <Eq>

      <FieldRef Name="Title"  />

      <Value Type="Text">TitleKey</Value>

    </Eq>

  </Where>

</Query>

      </m:query>

      <m:viewFields>

  <ViewFields>

    <FieldRef Name="MOVENotifikationSubject" />

    <FieldRef Name="MOVENotifikationBody" />

    <FieldRef Name="MOVENotifikationDescription" />

    <FieldRef Name="MOVEWFTypLookup" />

  </ViewFields>     

</m:viewFields>

      <m:rowLimit>

      </m:rowLimit>

      <m:queryOptions>

      </m:queryOptions>

      <m:webID>

      </m:webID>

    </m:GetListItems>

  </soap:Body>

</soap:Envelope>

Badge +6

Figured it out thanks to a great example. Here is my working query:

<?xml version="1.0" encoding="utf-8"?>

<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">

<soap12:Body>

<GetListItems xmlns="http://schemas.microsoft.com/sharepoint/soap/">

<listName>LISTNAME OR {GUID} here</listName>

<viewName></viewName>

<rowLimit>5000</rowLimit>

<query>

  <Query xmlns="">

  <Where>

  <Eq>

  <FieldRef Name="Title"  />

  <Value Type="Text">FilterParameter</Value>

  </Eq>

  </Where>

  </Query>

</query>

<viewFields>

  <ViewFields xmlns="">

  <FieldRef Name="FIELD1" />

  <FieldRef Name="FIELD2" />

  <FieldRef Name="FIELD3" />

  <FieldRef Name="FIELD4" />

  </ViewFields>

</viewFields>

<queryOptions>

  <QueryOptions xmlns="http://schemas.microsoft.com/sharepoint/soap/">

  <IncludeMandatoryColumns>FALSE</IncludeMandatoryColumns>

  <IncludeAttachmentUrls>FALSE</IncludeAttachmentUrls>

  <ViewAttributes Scope='RecursiveAll' IncludeRootFolder='True' />

  <DateInUtc>TRUE</DateInUtc>

  </QueryOptions>

</queryOptions>

</GetListItems>

</soap12:Body>

</soap12:Envelope>

Reply