question

Kim Strasser avatar image
Kim Strasser asked

Why is my friend's user profile null?

I want that a player can see some information about his friends but It's not possible to show the informations to the player because the friend's profile is null. For example, I want to get the AvatarUrl from the profile.

Why is the profile null?

What is PlayerProfile.Origination? Is this the country where the player is logged in right now with his device?

        public async void GetFriends()
        {
            await NewGetFriends();
        }

        private async Task NewGetFriends()
        {
            var request = await PlayFabClientAPI.GetFriendsListAsync(new GetFriendsListRequest()
            {
                IncludeSteamFriends = false,
                IncludeFacebookFriends = false
            });


            if (request.Error != null)
            {
                Console.WriteLine(request.Error.GenerateErrorReport());
            }
            else
            {
                _friends = request.Result.Friends;

                foreach (var entry in _friends)
                {
                    FriendsList.Add(new FriendsContainer(entry.FriendPlayFabId, entry.TitleDisplayName, entry.Profile.AvatarUrl, entry.Profile.PlayerId, entry.Profile.Origination.Value.ToString()));
                }
            }
        }
Account Management
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Sarah Zhang avatar image
Sarah Zhang answered

Please add this line of code. You need to initialize ProfileConstraints. Check the API to learn more.

IncludeSteamFriends = false,

IncludeFacebookFriends = false,

// determine the properties that you need
ProfileConstraints = new PlayerProfileViewConstraints { ShowCreated = true },


10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Error rendering WebPanel (widgets/consolidation-widget.ftl): org.hibernate.hql.internal.ast.QuerySyntaxException: AvailableConsolidation is not mapped [from AvailableConsolidation up where up.node = :node]