首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Sitecore8社交连接不导入已配置的Facebook配置文件属性

Sitecore8社交连接不导入已配置的Facebook配置文件属性
EN

Stack Overflow用户
提问于 2015-01-06 09:44:55
回答 2查看 624关注 0票数 1

根据本文:我应该将Sitecore.Social.ProfileMapping.Facebook.config中配置的属性导入到SC用户配置文件中:http://techmusingz.wordpress.com/2014/07/03/social-connected-with-sitecore-facebook-2-access-facebook-information/

然而,我得到的只有以下内容:

代码语言:javascript
复制
fb_basicData_id: 100001964217563
fb_basicData_email: <hidden>@hotmail.com
fb_basicData_appKey: <hidden> 
fb_basicData_appSecret: <hidden> 
fb_basicData_accessTokenSecret: <hidden> 
fb_lastRenewed: 20150106T013821Z 
fb_fieldsLastRenewed: 20150105T234345Z

如何填充其他属性?

EN

回答 2

Stack Overflow用户

发布于 2015-01-24 01:48:22

从3.0版开始,Social Connected将社交档案字段存储在Sitecore xDB联系人方面。这就是为什么在用户配置文件中没有它们的原因。

要获取必填字段,您应该使用Social Connected API。特别是,您应该使用SocialProfileManager类的GetSocialProfile方法来获取特定网络中用户的社交档案。然后,您将可以访问社交配置文件的fields属性中的所有社交配置文件字段。示例:

代码语言:javascript
复制
var socialProfileManager = ExecutingContext.Current.IoC.Get<ISocialProfileManager>(); // or create it directly: new SocialProfileManager();
var socialProfile = socialProfileManager.GetSocialProfile(“userName”, “Facebook”);
var facebookGender = socialProfile.Fields[“fb_gender”]; 
票数 3
EN

Stack Overflow用户

发布于 2015-12-07 18:10:54

我在Sitecore 8上也遇到过同样的问题。事实上,facebook的基本数据可以从GetCustomProperty函数中获得,但其余的个人资料数据后来被检索出来,并在SocialProfileManager下可用。

要使此类可用,请记住在项目中引用Sitecore.Social.Api.dll和Sitecore.Social.Domain.dll。

在那之后f.e.:

代码语言:javascript
复制
string facebook_email = Sitecore.Context.User.Profile.GetCustomProperty("fb_basicData_email");
if (!String.IsNullOrEmpty(facebook_email))
{
    email.Text = facebook_email; // update UI here
}
var socialProfile = new SocialProfileManager();
// Do we have an extra profile from the user?
if (socialProfile.SocialProfileExists(user.Name, "Facebook"))
{
    var facebookProfile = socialProfile.GetSocialProfile(user.Name, "Facebook");
    if (facebookProfile.Fields["fb_first_name"] != null)
    {
        // do something here
    }
}
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/27790851

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档