Issue: Can’t change the FROM address in SharePoint Online with a “send an email” action created through workflow.
Workaround: Call the HTTP Web Service Action
-
- Create a site workflow or a list workflow.
- Set the Go to Stage to End of Workflow.
- Create a new variable called: variableUsers. Type: String.
- Set a workflow variable action to Workflow Context: Initiator. (This is who will be emailed)
- Add a Replace Substring in a String action.
- Replace ; with “,” (The quotation marks should be included) in a variable called variableUsers.(email address, semi-colon delimited) With the Output to itself the, Variable: variableUsers.
- Create a 2nd replace action, this time replace a \ with \\ in Variable: variableUsers(email address, semi-colon delimited), with the output to itself again.
- Set a new workflow variable action to variableUsers with [” and “] on each side, it should look like: [“[%Variable: variableUsers%]”] as a string in the String Builder.
- Now create an action called Build Dictionary. This dictionary will have 5 variables. Create a new dictionary variable – Output to Variable: requestBody.
Name Type Value properties/__metadata/type String SP.Utilities.EmailProperties properties/Subject String Hello properties/From String validSPUser@contoso.com properties/Body String This is the email body and the HTML of a normal send an email action can be copied into this value. properties/To/results Dictionary variableUsers - Create a second Build Dictionary Action. Create a new dictionary variable – Output to requestHeaders.
Name Type Value Accept String application/json; odata=verbose Content-Type String application/json; odata=verbose - Add a Call HTTP Web Service Action.
- Under “this” HTTP web service select the “…”. Click Add or Change Lookup – Workflow Context: Current Site URL, after the lookup type
/_vti_bin/client.svc/sp.utilities.utility.SendEmail. So, it should look like:[%Workflow Context:Current Site URL%]/_vti_bin/client.svc/sp.utilities.utility.SendEmail
- Change the HTTP method to HTTP POST.
- Under the request select the requestBody variable.
- On the far right of the Call HTTP Web service action select the arrow and click Properties. Under the RequestHeaders dropdown select the variable requestHeaders.
- Publish and run the workflow.
Is this method still valid?
LikeLike