Précis
So I’ve had folks say that they still cant make the leap and get my examples to work in Office 365 SharePoint Online, so this post is to Prove out that IT can be done, there is no smoke and mirrors, I just wanted folks to take what I have and use that to go to the next level. This is not like a live session where I have an interactive audience, so I am putting the info out there in his blog.
This post builds on a few out there that I have done explaining how to use SharePoint Designer 2013 with the Dictionary Object to data in JSON Format to be used inside Workflows. Now, I do admit that there are VERY FEW examples out there, if any, that show you, how to do what I am about to tackle in Office 365 SharePoint Online. So here goes.
Approach
As usual we have an Initialization Stage and a Workhorse Stage, in the Init stage we will set our variables and make our REST call, we will parse it and limit our dataset to what we need for our results. I think folks are getting tripped up on what is needed in the Headers, as what I am getting as feedback is that the Workflow Starts but it stalls with a message like “Retrying last request. Next attempt scheduled after…” with a correlation ID, it also gives you a Retry Now Link.
So the first thing i will show you is of course what is in my List NOW, I will show it to you via the browser and in Fiddler.
now here is the items in Fiddler, i do this so you can appreciate the actions I will take later on in SPD when parsing the JSON data.
Now lets look at how we construct the Header, in this post, i have explained why you need certain Headers, so i wont go into it here, the only difference is that I am extrapolating what I did in Fiddler and using it in SharePoint Designer… now for obvious reasons, I am NOT showing you all the Header Information since it is my Valid Token to O365.
Now with that done, I have constructed a Site Workflow that will loop through the items and Log it to History, what you do with it for your Use Case can be quite elaborate, you essentially can
- Communicate with any Office 365 SharePoint Online Tennant you want from a Single Workflow
- Cross Communicate between an On Prem Farm and a Cloud Farm in one Workflow
- Create List, Libraries, List Items, and do full CRUD operations
If you go and look at the REST API endpoints from that link i gave you before by Kirk Evans, you can see that its quite a bunch of things that are available now.
So. back to the story.
First Part of the Workflow
Second Pare of the Workflow
Next lets fire off this Workflow and look at the results.
Proof
Next we go to Site Contents, Site Workflows and click the one we just created after publishing
We should expect to see the below in our History List
and upon closer inspection of the Workflow
Summary
Now what I will say because I have worked quite a bit with SharePoint Online Wave 15 is that it can get squirrely and can crap out on you for no good apparent reason, it gives you obscure feedback when it does and often times it just says “something bad has happened..” and if you Refresh the browser, its back to normal. I don’t pretend to understand why, I don’t have eyes into the Data Centre nor access to the ULS Logs, so I am as much as in the blind as you are. BUT this is the reason why i do Fiddler first then SPD after…visibility.
I hope this helps! Cheers.
Pingback: HELP: Unable to Create List using SharePoint 2013 REST API in SPD2013 « Fabian Williams SharePoint Blog
Fabian, when I am adding the cookie as a dictionary variable , its gives this error.:
Suspend this workflow
Activity in progress
Retrying last request. Next attempt scheduled in less than one minute. Details of last request: HTTP InternalServerError to https://xxxxx.sharepoint.com/sites/Sub1/_vti_bin/client.svc/web/lists(guid'31396c4b-7041-4555-bf22-dc110a9a4761‘)/Items Correlation Id: b984428c-075c-8d67-83fa-3bf9ac550428 Instance Id: 13fb165d-a93c-4bfc-9bbd-2bfc17288bf2
Invalid text value.
A text field contains invalid data. Please check the value and try again.
Retry now
………….I am working in sharepoint online
Use fiddler and execute the same URI and ofcourse fill out the headers properly, then you cans see what comes back as the hTTP response. once you get that, you should be able to get more information and then be able to fix it.
Fabian,
In fiddler its working perfectly. I filled the header properly , and getting json respose.
But when I copy the cookie from fiddler and paste to the designer , it gives me the above error.
Pingback: How to Get SharePoint Online 2013 User Profile Properties | BATES ITS
Hi, my Cookie header values rtFa and FedAuth are configured in my SharePoint Designer Workflow. But after many days, this values has changed. This is posible? How can I set this values dynamically? For example my X-RequestDigest value it’s getting from SP Designer dynamically. Thanks!!
Yes this will most definitely happen, the cookies are valid for a period of time. You should not need to hard code the cookies in SharePoint Designer because you are already logged in when you execute it. I only did that as a means to show in Fiddler. If you need to do steps that need elevated privileges, use an App Step as I also speak about in other blog posts.
How can I create a new list item using the Call Web HTTP service in SharePoint Designer 2013? Because I tried everything I know of and it’s not working.
Pingback: Workflow Loop Through Multiple SharePoint Items | Laura Rogers @WonderLaura
Blog posts like this are what makes this blog amazing, $NAME. I really find this information very useful. Excited to read more similar contents from you in the future. More power!