Sitecore return field "Fields" with zero count in SocialProfiles

53 views Asked by At

Sitecore return field "Fields" with zero count in SocialProfiles, but this fields in social network really exist. How I can get need fields?

    var socialProfileManager = new SocialProfileManager();
    var twitterNetwork = allProfiles.FirstOrDefault(x => x.NetworkName == "Twitter");
    if (twitterNetwork.Fields.Count != 0) //Dicitionary "Fields" is empty here
    {
         ...
    } 
1

There are 1 answers

0
Amir Setoudeh On

I had a similar situation where I was trying to retrieve the fields and dealing with the zero field count. Take a look at this post: https://stackoverflow.com/a/30519345/4897782

Specifically, my issue was resolved when I passed false as the second parameter in the base login method. The default true parameter attempts to update the profile asynchronously, making it unavailable during my attempts to do what you are doing.

To be able to override the parameter though, I had to deviate from the standard out of the box login controls and implement my own version of what happens when you click login. It's pretty simple though. Take a look at the post and hopefully that resolves your issue.