4

In SharePoint 2013, workflows we can do a web service call. With this feature we can use SharePoint REST services within the workflow.

I want to post to the current users newsfeed from a workflow by using the SharePoint REST api for Social. So I created a sharepoint 2013 site workflow in SPD. For the HTTP Web Service call I added dictionaries for request header and request content as below:

Request Header:

Accept : application/json; odata=verbose

Content-Type: application/json; odata=verbose

Request Content:

"restCreationData":
 {
  "__metadata":{
        "type":"SP.Social.SocialRestPostCreationData"
      },
  "ID":null,
  "creationData":{
        "__metadata":{
          "type":"SP.Social.SocialPostCreationData"
        },
        "ContentText":"This post was published using REST.", 
        "UpdateStatusText":false
  }
}

The workflow completes, but it did not post to the newsfeed.

Can anyone tell me what I have missed here?

1 Answer 1

1

I have very similar problem and i use fiddler for debugging and view web service request&response. I got follow stack trace:

   Microsoft.Office.Server.UserProfiles.UserProfileManager..ctor(UserProfileApplicationProxy userProfileApplicationProxy, Guid partitionID, Boolean IgnoreUserPrivacy, Boolean isWithinProfileSync, Boolean assumeProfileAdmin)
   at Microsoft.Office.Server.UserProfiles.UserProfileManager..ctor(UserProfileApplicationProxy userProfileApplicationProxy, Guid partitionID, Boolean IgnoreUserPrivacy, Boolean isWithinProfileSync)
   at Microsoft.Office.Server.UserProfiles.UserProfileManager..ctor(UserProfileApplicationProxy userProfileApplicationProxy, Guid partitionID, Boolean IgnoreUserPrivacy)
   at Microsoft.Office.Server.UserProfiles.ProfileLoader.get_UserProfileManager()
   at Microsoft.Office.Server.Microfeed.MBUtilities.GetUserProfile(String accountName, SPServiceContext context, MicrofeedLookupUserProfile lookupBy, Boolean& isFullProfile)
   at Microsoft.Office.Server.Social.SPSocialFeedManager.<.ctor>b__0()
   at Microsoft.Office.Server.Social.SPSocialUtil.InvokeWithExceptionTranslation(ISocialOperationManager target, String name, Action action)
   at Microsoft.Office.Server.Social.SPSocialRestFeedManager..ctor()
   at Microsoft.Office.Server.Social.SPSocialRestFeedManagerServerStub.InvokeConstructor(ClientValueCollection xmlargs, ProxyContext proxyContext)
   at Microsoft.SharePoint.Client.ServerStub.InvokeConstructorWithMonitoredScope(ClientValueCollection args, ProxyContext proxyContext)

I think UserProfileManager require HttpContext.Current but in workflow it doesn't exist because workflow running in other process in Workflow Manger.

You can try to experiment with other api function

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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