DEV Community

Frederik Van Lierde
Frederik Van Lierde

Posted on

A Super Easy Way to Automate Posting on LinkedIn with .Net

(Including Business pages, Showcase Pages and Personal Account)

LinkedIn is an effective platform to boost your online branding. The more visibility you and your company have on LinkedIn, the more people will know who you are. All this means it’s important to post regularly on LinkedIn.

Having more than 700 million active users around the world, we can say LinkedIn is a powerful marketing tool.

Let me showcase to you how easy it is to post on LinkedIn from your .Net project, not only on your personal account but as your business on your business page or showcase pages.

Table of Contents

  • Summary
  • Difference between Business Page and Show Case Page
  • Prerequisites
  • Posting a Text Message onto a Page
  • Posting an Article onto a Page (URL)
  • Posting an Image onto a Page (URL)
  • Live Example

Difference between Business Page and Show Case Page

A business page is representing your (official) business, whereas a showcase page is where you showcase a product, an event, or an initiative related to your business.

Prerequisites

  • CodeHelper.API.LinkedIn
  • Get an Access Token by creating an App on Developers LinkedIn with w_organization_social scope     ## Features
  • AuthorTypes can be Person, Company or **ShowCase*
  • VisibilityTypes can be Public or Connections
  • Optional, you can add a title and description to your article
  • Optional, you can add a title and description to your article
  • Currently, LinkedIn accept PNG and JPG formats     ## Posting a Text Message on a Page
LinkedInHelper _helper = new() { AccessToken = "AQVjgglPI-......” };
var _id = await _helper.GetAuthorID();
_helper.AuthorType = AuthorTypes.ShowCase;

string _textMessage =”Hello LinkedIn World!\n\rMy first automated text message”;

await _helper.ShareTextMessage(_textMessage);
Enter fullscreen mode Exit fullscreen mode


Posting an Image onto a Page

LinkedInHelper _helper = new() { AccessToken = "AQVjgglPI-......” };
var _id = await _helper.GetAuthorID();
_helper.AuthorType = AuthorTypes.Company;

string _textMessage =”Find out my latest articles…..”;

await _helper.ShareUrl(_textMessage, "https://frederik.today/codehlper/articles", VisibilityTypes.Public, "Latest .Net Articles", "The latest .Net rticles by CodeHelper, offering examples, ideas and more") ;
Enter fullscreen mode Exit fullscreen mode


Posting an Image onto a Page

LinkedInHelper _helper = new() { AccessToken = "AQVjgglPI-......” };
var _id = await _helper.GetAuthorID();
_helper.AuthorType = AuthorTypes.Company;

string _textMessage =”Posting an Image with .Net”;
byte[] _image = File.ReadAllBytes(@"c.\...\LinkedIntestImage.jpeg");

await _helper.ShareImage_textMessage,  _image, VisibilityTypes.Public, "My Image Title", "MyImage Description");
Enter fullscreen mode Exit fullscreen mode


LIVE EXAMPLE

Top comments (0)