SharePoint SharePoint Workflow - HttpSend action prevents deserialization of JSON data

Basically, I'm trying to create a workflow ( sharepoint 2013 for o365 ) that will send an email to the manager of the document manager.

To do this, I created user activity in VS 2012 , which should return a bootloader profile, from where I would like to extract the manager login.

I use HttpSend and the following REST service for this action:

 uri + "_api/SP.UserProfiles.PeopleManager/GetPropertiesFor( accountName=@v ) ?@v ='" + Login + "'" 

The answer is fine - I intercepted it with a violinist and I can parse it with JSON parser (including inclusion in Fiddler)

 {"d":{"__metadata": {"id":"http://sp13dev/sites/dev/_api/SP.UserProfiles.PeopleManager/GetPropertiesFor( accountName=@v )","uri":"http://sp13dev/sites/dev/_api/SP.UserProfiles.PeopleManager/GetPropertiesFor( accountName=@v )","type":"SP.UserProfiles.PersonProperties"},"AccountName":"MVO\\mvogelsi","DirectReports":{"results":[]},"DisplayName":"Marcin Vogelsinger","Email":null,"ExtendedManagers":{"results":["MVO\\rmakowsk"]},"ExtendedReports":{"results":["MVO\\mvogelsi"]},"IsFollowed":false,"LatestPost":null,"Peers":{"results":["MVO\\tbiolo"]},"PersonalUrl":"http://sp13dev/my/Person.aspx?accountname=MVO%5Cmvogelsi","PictureUrl":null,"Title":null,"UserProfileProperties": {"results":[{"__metadata":{"type":"SP.KeyValue"},"Key":"UserProfile_GUID","Value":"b3d09b4d-0d7e-45be-a3d9-b9f23a972e9c","ValueType":"Edm.String"},{"__metadata":{"type":"SP.KeyValue"},"Key":"SID","Value":"S-1-5-21-28665521-4166225307-422210891-1000","ValueType":"Edm.String"},{"__metadata":{"type":"SP.KeyValue"},"Key":"ADGuid","Value":"","ValueType":"Edm.String"},{"__metadata":{"type":"SP.KeyValue"},"Key":"AccountName","Value":"MVO\\mvogelsi","ValueType":"Edm.String"},{"__metadata":{"type":"SP.KeyValue"},"Key":"FirstName","Value":"Marcin","ValueType":"Edm.String"},{"__metadata":{"type":"SP.KeyValue"},"Key":"SPS-PhoneticFirstName","Value":"","ValueType":"Edm.String"},{"__metadata":{"type":"SP.KeyValue"},"Key":"LastName","Value":"Vogelsinger","ValueType":"Edm.String"},{"__metadata":{"type":"SP.KeyValue"},"Key":"SPS-PhoneticLastName","Value":"","ValueType":"Edm.String"},{"__metadata":{"type":"SP.KeyValue"},"Key":"PreferredName","Value":"Marcin Vogelsinger","ValueType":"Edm.String"},{"__metadata":{"type":"SP.KeyValue"},"Key":"SPS-PhoneticDisplayName","Value":"","ValueType":"Edm.String"},{"__metadata":{"type":"SP.KeyValue"},"Key":"WorkPhone","Value":"888265520","ValueType":"Edm.String"},{"__metadata":{"type":"SP.KeyValue"},"Key":"Department","Value":"","ValueType":"Edm.String"},{"__metadata":{"type":"SP.KeyValue"},"Key":"Title","Value":"","ValueType":"Edm.String"},{"__metadata":{"type":"SP.KeyValue"},"Key":"SPS-JobTitle","Value":"","ValueType":"Edm.String"},{"__metadata":{"type":"SP.KeyValue"},"Key":"SPS-Department","Value":"","ValueType":"Edm.String"},{"__metadata":{"type":"SP.KeyValue"},"Key":"Manager","Value":"MVO\\rmakowsk","ValueType":"Edm.String"},{"__metadata":{"type":"SP.KeyValue"},"Key":"AboutMe","Value":"","ValueType":"Edm.String"},{"__metadata":{"type":"SP.KeyValue"},"Key":"PersonalSpace","Value":"SPSSITEERROR","ValueType":"Edm.String"},{"__metadata":{"type":"SP.KeyValue"},"Key":"PictureURL","Value":"","ValueType":"Edm.String"},{"__metadata":{"type":"SP.KeyValue"},"Key":"UserName","Value":"mvogelsi","ValueType":"Edm.String"},{"__metadata":{"type":"SP.KeyValue"},"Key":"QuickLinks","Value":"","ValueType":"Edm.String"},{"__metadata":{"type":"SP.KeyValue"},"Key":"WebSite","Value":"","ValueType":"Edm.String"},{"__metadata":{"type":"SP.KeyValue"},"Key":"PublicSiteRedirect","Value":"","ValueType":"Edm.String"},{"__metadata":{"type":"SP.KeyValue"},"Key":"SPS-Dotted-line","Value":"","ValueType":"Edm.String"},{"__metadata":{"type":"SP.KeyValue"},"Key":"SPS-Peers","Value":"","ValueType":"Edm.String"},{"__metadata":{"type":"SP.KeyValue"},"Key":"SPS-Responsibility","Value":"","ValueType":"Edm.String"},{"__metadata":{"type":"SP.KeyValue"},"Key":"SPS-SipAddress","Value":"","ValueType":"Edm.String"},{"__metadata":{"type":"SP.KeyValue"},"Key":"SPS-MySiteUpgrade","Value":"","ValueType":"Edm.String"},{"__metadata":{"type":"SP.KeyValue"},"Key":"SPS-ProxyAddresses","Value":"","ValueType":"Edm.String"},{"__metadata":{"type":"SP.KeyValue"},"Key":"SPS-HireDate","Value":"","ValueType":"Edm.String"},{"__metadata":{"type":"SP.KeyValue"},"Key":"SPS-DisplayOrder","Value":"","ValueType":"Edm.String"},{"__metadata":{"type":"SP.KeyValue"},"Key":"SPS-ClaimID","Value":"","ValueType":"Edm.String"},{"__metadata":{"type":"SP.KeyValue"},"Key":"SPS-ClaimProviderID","Value":"Windows","ValueType":"Edm.String"},{"__metadata":{"type":"SP.KeyValue"},"Key":"SPS-ClaimProviderType","Value":"Windows","ValueType":"Edm.String"},{"__metadata":{"type":"SP.KeyValue"},"Key":"SPS-SavedAccountName","Value":"MVO\\mvogelsi","ValueType":"Edm.String"},{"__metadata":{"type":"SP.KeyValue"},"Key":"SPS-SavedSID","Value":"System.Byte[]","ValueType":"Edm.String"},{"__metadata":{"type":"SP.KeyValue"},"Key":"SPS-ResourceSID","Value":"","ValueType":"Edm.String"},{"__metadata":{"type":"SP.KeyValue"},"Key":"SPS-ResourceAccountName","Value":"","ValueType":"Edm.String"},{"__metadata":{"type":"SP.KeyValue"},"Key":"SPS-ObjectExists","Value":"","ValueType":"Edm.String"},{"__metadata":{"type":"SP.KeyValue"},"Key":"SPS-MasterAccountName","Value":"","ValueType":"Edm.String"},{"__metadata":{"type":"SP.KeyValue"},"Key":"SPS-UserPrincipalName","Value":" mvogelsi@mvo.dom ","ValueType":"Edm.String"},{"__metadata":{"type":"SP.KeyValue"},"Key":"SPS-PersonalSiteCapabilities","Value":"0","ValueType":"Edm.String"},{"__metadata":{"type":"SP.KeyValue"},"Key":"SPS-O15FirstRunExperience","Value":"","ValueType":"Edm.String"},{"__metadata":{"type":"SP.KeyValue"},"Key":"SPS-PersonalSiteInstantiationState","Value":"8197","ValueType":"Edm.String"},{"__metadata":{"type":"SP.KeyValue"},"Key":"SPS-DistinguishedName","Value":"CN=Marcin Vogelsinger,CN=Users,DC=mvo,DC=dom","ValueType":"Edm.String"},{"__metadata":{"type":"SP.KeyValue"},"Key":"SPS-SourceObjectDN","Value":"","ValueType":"Edm.String"},{"__metadata":{"type":"SP.KeyValue"},"Key":"SPS-FeedIdentifier","Value":"","ValueType":"Edm.String"},{"__metadata":{"type":"SP.KeyValue"},"Key":"WorkEmail","Value":"","ValueType":"Edm.String"},{"__metadata":{"type":"SP.KeyValue"},"Key":"CellPhone","Value":"","ValueType":"Edm.String"},{"__metadata":{"type":"SP.KeyValue"},"Key":"Fax","Value":"","ValueType":"Edm.String"},{"__metadata":{"type":"SP.KeyValue"},"Key":"HomePhone","Value":"","ValueType":"Edm.String"},{"__metadata":{"type":"SP.KeyValue"},"Key":"Office","Value":"","ValueType":"Edm.String"},{"__metadata":{"type":"SP.KeyValue"},"Key":"SPS-Location","Value":"","ValueType":"Edm.String"},{"__metadata":{"type":"SP.KeyValue"},"Key":"Assistant","Value":"","ValueType":"Edm.String"},{"__metadata":{"type":"SP.KeyValue"},"Key":"SPS-PastProjects","Value":"","ValueType":"Edm.String"},{"__metadata":{"type":"SP.KeyValue"},"Key":"SPS-Skills","Value":"","ValueType":"Edm.String"},{"__metadata":{"type":"SP.KeyValue"},"Key":"SPS-School","Value":"","ValueType":"Edm.String"},{"__metadata":{"type":"SP.KeyValue"},"Key":"SPS-Birthday","Value":"","ValueType":"Edm.String"},{"__metadata":{"type":"SP.KeyValue"},"Key":"SPS-StatusNotes","Value":"","ValueType":"Edm.String"},{"__metadata":{"type":"SP.KeyValue"},"Key":"SPS-Interests","Value":"","ValueType":"Edm.String"},{"__metadata":{"type":"SP.KeyValue"},"Key":"SPS-HashTags","Value":"","ValueType":"Edm.String"},{"__metadata":{"type":"SP.KeyValue"},"Key":"SPS-EmailOptin","Value":"","ValueType":"Edm.String"},{"__metadata":{"type":"SP.KeyValue"},"Key":"SPS-PrivacyPeople","Value":"False","ValueType":"Edm.String"},{"__metadata":{"type":"SP.KeyValue"},"Key":"SPS-PrivacyActivity","Value":"0","ValueType":"Edm.String"},{"__metadata":{"type":"SP.KeyValue"},"Key":"SPS-TimeZone","Value":"","ValueType":"Edm.String"}]},"UserUrl":"http://sp13dev:80/my/Person.aspx?accountname=MVO%5Cmvogelsi"}} 

I used this customizable activity as part of a simple workflow created with sp designer 2013 and deployed in my dev environment. But when you try to start a workflow, it is canceled and the following error appears:

 Details: System.IO.InvalidDataException: Unable to deserialize HTTP response content. Expected ContentType : 'application/json', 'text/plain' or 'text/html', Received ContentType : 'application/json'. Content (truncated) : '{"d":{"__metadata":{"id":"http://sp13dev/sites/dev/_api/SP.UserProfiles.PeopleManager/GetPropertiesFor( accountName=@v )","uri":"http://sp13dev [here goes the rest of JSON which is already available above] 

Since for o365 I need to go in a declarative way.

Has anyone encountered such a problem?

+4
source share
1 answer

I ran into a similar problem in the past and came across a blog that helped me set the same

The cause of the problem is, by default, the response from SharePoint REST in XML design and the SharePoint designer cannot parse xml and requires a JSON response. To solve this problem, we need to pass Accept and Content-Type as application / json; odata = verbose for requesting headers. So we get a JSON response.

https://prasadpathak.wordpress.com/tag/expected-content-type-applicationjson/

Try the steps mentioned in the above blog.

0
source

Source: https://habr.com/ru/post/1479508/


All Articles