SparkleNetworks / LinkedInNET

Sparkle.LinkedInNET will help you query the LinkedIn API with C# :)
https://www.nuget.org/packages/Sparkle.LinkedInNET/
GNU Lesser General Public License v3.0
35 stars 51 forks source link

Post a message on LinkedIn with LinkedInNet #20

Closed LeoLeDi closed 6 years ago

LeoLeDi commented 6 years ago

Hi, and thank you for this client !

i have a question : how can i post a message using LinkedInNet ? I tried to do something like this :

try
{
    Sparkle.LinkedInNET.Common.PostShare post = new Sparkle.LinkedInNET.Common.PostShare();
    post.Content = new Sparkle.LinkedInNET.Common.PostShareContent();
    post.Comment = "Check out developer.linkedin.com!";

    post.Content.Title = "test api";
    post.Content.Description = "ok";
    post.Content.SubmittedUrl = "https://developer.linkedin.com";

    post.Visibility = new Sparkle.LinkedInNET.Common.Visibility();
    post.Visibility.Code = "anyone";
    api.Social.Post(user, post);
}
catch (LinkedInApiException e)
{
}

but it's said me the access is denied... however, i succeed to connect myself with OAuth, and i have already access to my personnal info !

Thanks for your help :)

Léo

sandrock commented 6 years ago

If you get the following error,

API error (403) Access to posting shares denied at https://api.linkedin.com/v1/people/~/shares

it may be because:

Is this the exact error you encounter? Is the issue on your side?

LeoLeDi commented 6 years ago

Yes, i did a mistake, i forget the AuthorizationScope.WriteShare permission. Thank you :)