Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/285.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# LinkedIn API v2和Sparkle.LinkedInNET:检索摘要和技能_C#_Api_Linkedin - Fatal编程技术网

C# LinkedIn API v2和Sparkle.LinkedInNET:检索摘要和技能

C# LinkedIn API v2和Sparkle.LinkedInNET:检索摘要和技能,c#,api,linkedin,C#,Api,Linkedin,我正在实现一个LinkedIn API阅读器,以获得用户的总结和技能。 OAuth2身份验证过程工作正常,但当我尝试检索概要文件对象时,我在这里遇到了问题: public void OAuth2(string code, string state, string error, string error_description) { // create a configuration object var config = new LinkedInApiConfiguration(

我正在实现一个LinkedIn API阅读器,以获得用户的总结和技能。 OAuth2身份验证过程工作正常,但当我尝试检索概要文件对象时,我在这里遇到了问题:

public void OAuth2(string code, string state, string error, string error_description)
{
    // create a configuration object
    var config = new LinkedInApiConfiguration("api-key", "api-secret-code");

    // get the APIs client
    var api = new LinkedInApi(config);

    if(!string.IsNullOrEmpty(error) || !string.IsNullOrEmpty(error_description))
    {
        // handle error and error_description
    }
    else
    {
        var redirectUrl = "http://mywebsite/LinkedIn/OAuth2";
        var userToken = api.OAuth2.GetAccessToken(code, redirectUrl);


        var user = new UserAuthorization(userToken.AccessToken);
        var profile = api.Profiles.GetMyProfile(user); //Here I don't know what to pass as acceptLanguages and FieldSelector!!
    }    
}
没有与“ProfilesApi.GetMyProfile(UserAuthorization,string[],FieldSelector)”的必需形式参数“acceptLanguages”相对应的参数

我试图理解Sparkle.LinkedIn Api项目,但没有文档


我只想检索summary和skills字段。

通过创建一个包含语言代码和FIeldSelector变量的简单数组来解决:

var acceptLanguages = new string[] { "it-IT","en-US", };
var fields = FieldSelector.For<Person>()
            .WithId()
            .WithFirstName()
            .WithLastName()
            .WithFormattedName()
            .WithEmailAddress()
            .WithHeadline()
            .WithLocationName()
            .WithLocationCountryCode()
            .WithPictureUrl()
            .WithPublicProfileUrl()
            .WithSummary();
Person profile = api.Profiles.GetMyProfile(user,acceptLanguages,fields);
var-acceptLanguages=newstring[]{“it”、“en-US”,};
var fields=FieldSelector.For()
.WithId()
.WithFirstName()
.WithLastName()
.WithFormattedName()
.WithEmailAddress()
.附标题()
.WithLocationName()
.WithLocationCountryCode()
.WithPictureUrl()
.WithPublicProfileUrl()
.with summary();
Person profile=api.Profiles.GetMyProfile(用户、接受语言、字段);