2

I have a SharePoint Designer site workflow in SharePoint 2013 (Online) that I'm using to loop through a list, and collect properties from each item using the REST API. One of the columns I'm looking at is contains a date and time, and the JSON value returned by the API is ISO-formatted, like this:

2016-07-10T14:00:00Z

When I try to set a Date/Time variable to this value I get the following error and the workflow is suspended:

The conversion could not be completed because the supplied DateTime did not have the Kind property set correctly. For example, when the Kind property is DateTimeKind.Local, the source time zone must be TimeZoneInfo.Local

Is this kind of conversion actually possible in a SharePoint 2013 workflow? This article suggests it can be done with a SharePoint 2010 workflow, but that doesn't mean that Microsoft didn't remove the feature from 2013 workflows, as it did with many others.

If it's not possible then my fallback is to retrieve the Id property from the API response, then look up the date using the Set workflow variable action, however, since I've already retrieved the data from the API, I'd rather use that if I can.

1
  1. Split your ISO date format with the help of Utility action in SharePoint designer 2013
  2. Set that splited variable to dateTime of workflow variable.

reference : Split ISO format Date

link

1

I found SharePoint Designer workflows don't seem to support time zones in their Date/Time variables at all. The workflow string parser is looking for a local time without a time zone, hence:

...the source time zone must be TimeZoneInfo.Local

By removing the Z (which implies UTC) from my ISO time format, I was able to get the workflow to correctly parse the date string, including the time portion.

However, since the date is parsed as if it is from the local time zone, it is now wrong, and needs to be corrected. I achieved this by requesting the time zone offset from the API at https://example.sharepoint.com/_api/web/RegionalSettings/TimeZone, and subtracting the Bias property (in minutes) from the date variable.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.