I have javascript code that finds the workflow association templatid for a specified list, then call spservices startworkflow for each item in the list. This code works correctly in an Office/365 (SharePoint 2013 Server) environment but fails with a 404 Not Found in a SharePoint 2013 Foundation environment. Have run with both Spservice 2013.01 and 2013.02 Alpha2.
The list item URL format being used in Spservices call looks like:
http://ecl2013/sites/SPMP4/DEPTF/Lists/Test/1_.000 on the foundation local server and similarly derived url with https on office/365.
Partial snippet of code is below and I have validated that the templateID and the itemURL are valid (and this works in Office/365 with http replace by https...
var enumListItems = listItems.getEnumerator(); // Enumerates all list items
The list item URL format being used in Spservices call looks like:
http://ecl2013/sites/SPMP4/DEPTF/Lists/Test/1_.000 on the foundation local server and similarly derived url with https on office/365.
Partial snippet of code is below and I have validated that the templateID and the itemURL are valid (and this works in Office/365 with http replace by https...
var enumListItems = listItems.getEnumerator(); // Enumerates all list items
while (enumListItems.moveNext()) // Performs actions for each list item
{
var listItem = enumListItems.get_current(); // Gets the current enumerated list item
var itemUrl = 'http://' + window.location.hostname + listItem.get_item("FileRef"); // Sets the url of the current list item
$('#worklog').append("<br />" + templateID);
$('#worklog').append("<br />" + itemUrl);
$().SPServices(
// Start workflow using SPServices
{
operation: "StartWorkflow",
item: itemUrl,
templateId: templateID,
workflowParameters: "<root />",
async: true,
completefunc: function () {
// Log that the workflow was run against an item
$('#worklog').append("<br />Workflow run against item id: " + listItem.get_id() + " " + t);
}
}); // Close SPServices
}