protected void Page_Load(object sender, EventArgs e) { LinkedInService service = new LinkedInService(base.Authorization); try { List<ProfileField> fields = new List<ProfileField> { ProfileField.CurrentShare, ProfileField.DateOfBirth, ProfileField.FirstName, ProfileField.Headline, ProfileField.Industry, ProfileField.LastName, ProfileField.LocationCountryCode, ProfileField.LocationName, ProfileField.NumberOfConnections, ProfileField.NumberOfConnectionsCapped, ProfileField.PersonId, ProfileField.PictureUrl, ProfileField.PublicProfileUrl }; Connections connections = service.GetConnectionsForCurrentUser(fields, Modified.Updated, 1); console.Text += Utilities.SerializeToXml<Connections>(connections); } catch (LinkedInException lie) { console.Text += lie.Message; } }
public void UnlikeNetworkUpdate_EmptyUpdateKeyParam_Test() { ILinkedInAuthorization authorization = new LinkedInAuthorizationMock(); LinkedInService target = new LinkedInService(authorization); target.UnlikeNetworkUpdate(string.Empty); }
public void CreateReShare_EmptyShareIdParam_Test() { ILinkedInAuthorization authorization = new LinkedInAuthorizationMock(); LinkedInService target = new LinkedInService(authorization); target.CreateReShare(string.Empty, string.Empty, VisibilityCode.ConnectionsOnly); }
protected void Page_Load(object sender, EventArgs e) { LinkedInService service = new LinkedInService(base.Authorization); connectionsDataList.DataSource = service.GetConnectionsForCurrentUser().Items; connectionsDataList.DataBind(); }
public void CreateReShare_UnknownVisibilityParam_Test() { ILinkedInAuthorization authorization = new LinkedInAuthorizationMock(); LinkedInService target = new LinkedInService(authorization); target.CreateReShare(string.Empty, Constants.Share_One_Id, VisibilityCode.Unknown); }
protected void Page_Load(object sender, EventArgs e) { LinkedInService service = new LinkedInService(base.Authorization); try { List <ProfileField> fields = new List <ProfileField> { ProfileField.CurrentShare, ProfileField.DateOfBirth, ProfileField.FirstName, ProfileField.Headline, ProfileField.Industry, ProfileField.LastName, ProfileField.LocationCountryCode, ProfileField.LocationName, ProfileField.NumberOfConnections, ProfileField.NumberOfConnectionsCapped, ProfileField.PersonId, ProfileField.PictureUrl, ProfileField.PublicProfileUrl }; Connections connections = service.GetConnectionsForCurrentUser(fields, Modified.Updated, 1); console.Text += Utilities.SerializeToXml <Connections>(connections); } catch (LinkedInException lie) { console.Text += lie.Message; } }
public void GetConnectionsForCurrentUser_ModifiedSinceOutOfRange_Test() { ILinkedInAuthorization authorization = new LinkedInAuthorizationMock(); LinkedInService target = new LinkedInService(authorization); target.GetConnectionsForCurrentUser(new List <ProfileField>(), Modified.Updated, 0); }
public void CreateShare_NoCommentParam_Test() { ILinkedInAuthorization authorization = new LinkedInAuthorizationMock(); LinkedInService target = new LinkedInService(authorization); target.CreateShare(null, VisibilityCode.ConnectionsOnly); }
public void GetConnectionsByMemberId_ModifiedSinceOutOfRange_Test() { ILinkedInAuthorization authorization = new LinkedInAuthorizationMock(); LinkedInService target = new LinkedInService(authorization); target.GetConnectionsByMemberId(Constants.MemberId, new List <ProfileField>(), 1, 10, Modified.Updated, 0); }
public void CommentOnNetworkUpdate_ToLongCommentParam_Test() { ILinkedInAuthorization authorization = new LinkedInAuthorizationMock(); LinkedInService target = new LinkedInService(authorization); target.CommentOnNetworkUpdate("update key", Constants.CreateShare_ToLongCommentParam); }
public void CreateShare_EmptyCommentParamAndNoUriParam_Test() { ILinkedInAuthorization authorization = new LinkedInAuthorizationMock(); LinkedInService target = new LinkedInService(authorization); target.CreateShare(string.Empty, Constants.ShareContent_One_Title, string.Empty, null, null, VisibilityCode.ConnectionsOnly, false); }
public void CreateShare_ToLongDescriptionParam_Test() { ILinkedInAuthorization authorization = new LinkedInAuthorizationMock(); LinkedInService target = new LinkedInService(authorization); target.CreateShare(string.Empty, Constants.ShareContent_One_Title, Constants.CreateShare_ToLongDescriptionParam, new Uri(Constants.ShareContent_One_SubmittedUrl), null, VisibilityCode.ConnectionsOnly, false); }
public void CommentOnNetworkUpdate_EmptyCommentParam_Test() { ILinkedInAuthorization authorization = new LinkedInAuthorizationMock(); LinkedInService target = new LinkedInService(authorization); target.CommentOnNetworkUpdate("update key", string.Empty); }
public void CommentOnNetworkUpdate_EmptyUpdateKeyParam_Test() { ILinkedInAuthorization authorization = new LinkedInAuthorizationMock(); LinkedInService target = new LinkedInService(authorization); target.CommentOnNetworkUpdate(string.Empty, null); }
public void PostNetworkUpdate_EmptyBodyParam_Test() { ILinkedInAuthorization authorization = new LinkedInAuthorizationMock(); LinkedInService target = new LinkedInService(authorization); target.PostNetworkUpdate(string.Empty, string.Empty); }
private static BaseAuthenticationInfo LocateLinkedinResponse() { var authorization = new WebOAuthAuthorization(LinkedinTokenManager, null); string accessToken; try { accessToken = authorization.CompleteAuthorize(); } catch (Exception ex) { return(null); } if (accessToken != null) { authorization = new WebOAuthAuthorization(LinkedinTokenManager, accessToken); LinkedInService service = new LinkedInService(authorization); var profile = service.GetCurrentUser(ProfileType.Public); var info = new LinkedinAuthenticationInfo(); info.FirstName = profile.FirstName; info.LastName = profile.LastName; info.Identifier = profile.Id; info.UserName = profile.Name; info.Provider = providerModule.GetProvider("LinkedIn"); return(info); } else { return(null); } }
public void UnlikeNetworkUpdate_NoUpdateKeyParam_Test() { ILinkedInAuthorization authorization = new LinkedInAuthorizationMock(); LinkedInService target = new LinkedInService(authorization); target.UnlikeNetworkUpdate(null); }
public void CreateReShare_ToLongCommentParam_Test() { ILinkedInAuthorization authorization = new LinkedInAuthorizationMock(); LinkedInService target = new LinkedInService(authorization); target.CreateReShare(Constants.CreateShare_ToLongCommentParam, Constants.Share_One_Id, VisibilityCode.Anyone); }
public ActionResult LinkedInCallback(string code, string state) { var linkedInService = new LinkedInService("81ed9a1o1frnfw", "1LhWRlz3ZCWxSjyF"); var urlHelper = new UrlHelper(ControllerContext.RequestContext); var callbackUrl = urlHelper.Action("LinkedInCallback", "Profile", null, "http"); state = Session["linkedin_state"].ToString(); var oauthToken = linkedInService.ExchangeCodeForToken(code, state, callbackUrl); var linkedInExists = _linkedAccountRepository.GetBy(l => l.AccountType == LinkedAccountType.LinkedIn && l.UserId == WebUser.Id); if (linkedInExists != null) { linkedInExists.AccessToken = oauthToken.access_token; linkedInExists.Scope = oauthToken.scope; _linkedAccountRepository.Update(linkedInExists); _unitOfWork.Commit(); } else { var linkedAccount = new LinkedAccount { AccountType = LinkedAccountType.LinkedIn, UserId = WebUser.Id, AccessToken = oauthToken.access_token, Scope = oauthToken.scope }; _linkedAccountRepository.Create(linkedAccount); _unitOfWork.Commit(); } return(RedirectToAction("Index")); }
protected void logOutButton_Click(object sender, EventArgs e) { LinkedInService service = new LinkedInService(base.Authorization); service.InvalidateToken(); this.AccessToken = null; loginStatusMultiView.ActiveViewIndex = 0; }
public HomeController(ILogger <HomeController> logger, LineService lineService, FBService fBService, GoogleService googleService, LinkedInService linkedService, MSService msService) { _logger = logger; _lineService = lineService; _fBService = fBService; _googleService = googleService; _linkedService = linkedService; _msService = msService; }
public void Search_IncludingPublicField_Test() { ILinkedInAuthorization authorization = new LinkedInAuthorizationMock(); LinkedInService target = new LinkedInService(authorization); Collection <ProfileField> profileFields = new Collection <ProfileField> { ProfileField.SitePublicProfileRequestUrl }; target.Search(string.Empty, string.Empty, string.Empty, string.Empty, true, SortCriteria.Connections, 0, 10, profileFields); }
public void GetConnectionsForCurrentUser_IncludingPublicField_Test() { ILinkedInAuthorization authorization = new LinkedInAuthorizationMock(); LinkedInService target = new LinkedInService(authorization); List <ProfileField> profileFields = new List <ProfileField> { ProfileField.SitePublicProfileRequestUrl }; target.GetConnectionsForCurrentUser(profileFields, -1, -1); }
public void GetCurrentUser_StandardProfileWithPublicField_Test() { ILinkedInAuthorization authorization = new LinkedInAuthorizationMock(); LinkedInService target = new LinkedInService(authorization); List <ProfileField> profileFields = new List <ProfileField> { ProfileField.SitePublicProfileRequestUrl }; target.GetCurrentUser(ProfileType.Standard, profileFields); }
protected void Page_Load(object sender, EventArgs e) { LinkedInService service = new LinkedInService(base.Authorization); try { List <ProfileField> fields = new List <ProfileField> { ProfileField.ApiStandardProfileRequestHeaders, ProfileField.ApiStandardProfileRequestUrl, ProfileField.Connections, ProfileField.EducationActivities, ProfileField.EducationDegree, ProfileField.EducationEndDate, ProfileField.EducationFieldOfStudy, ProfileField.EducationId, ProfileField.EducationSchoolName, ProfileField.EducationStartDate, ProfileField.FirstName, ProfileField.Headline, ProfileField.Honors, ProfileField.Industry, ProfileField.LastName, ProfileField.LocationCountryCode, ProfileField.LocationName, ProfileField.NumberOfRecommenders, ProfileField.PersonId, ProfileField.PictureUrl, ProfileField.PositionCompanyName, ProfileField.PositionEndDate, ProfileField.PositionId, ProfileField.PositionIsCurrent, ProfileField.PositionStartDate, ProfileField.PositionSummary, ProfileField.PositionTitle, ProfileField.PublicProfileUrl, ProfileField.SiteStandardProfileRequestUrl, ProfileField.Specialties, ProfileField.Summary, ProfileField.SitePublicProfileRequestUrl, ProfileField.ApiPublicProfileRequestUrl }; Person person = service.GetProfileByMemberId(Constants.TestMemberId, fields); console.Text += Utilities.SerializeToXml <Person>(person);; } catch (LinkedInException lie) { console.Text += lie.Message; } }
protected void Page_Load(object sender, EventArgs e) { LinkedInService service = new LinkedInService(base.Authorization); try { List<ProfileField> fields = new List<ProfileField> { ProfileField.ApiStandardProfileRequestHeaders, ProfileField.ApiStandardProfileRequestUrl, ProfileField.Connections, ProfileField.EducationActivities, ProfileField.EducationDegree, ProfileField.EducationEndDate, ProfileField.EducationFieldOfStudy, ProfileField.EducationId, ProfileField.EducationSchoolName, ProfileField.EducationStartDate, ProfileField.FirstName, ProfileField.Headline, ProfileField.Honors, ProfileField.Industry, ProfileField.LastName, ProfileField.LocationCountryCode, ProfileField.LocationName, ProfileField.NumberOfRecommenders, ProfileField.PersonId, ProfileField.PictureUrl, ProfileField.PositionCompanyName, ProfileField.PositionEndDate, ProfileField.PositionId, ProfileField.PositionIsCurrent, ProfileField.PositionStartDate, ProfileField.PositionSummary, ProfileField.PositionTitle, ProfileField.PublicProfileUrl, ProfileField.SiteStandardProfileRequestUrl, ProfileField.Specialties, ProfileField.Summary, ProfileField.SitePublicProfileRequestUrl, ProfileField.ApiPublicProfileRequestUrl }; Person person = service.GetProfileByMemberId(Constants.TestMemberId, fields); console.Text += Utilities.SerializeToXml<Person>(person); ; } catch (LinkedInException lie) { console.Text += lie.Message; } }
public void GetOutOfNetworkProfile_InvalidUrl_Test() { ILinkedInAuthorization authorization = new LinkedInAuthorizationMock(); LinkedInService target = new LinkedInService(authorization); ApiRequest apiRequest = new ApiRequest { Url = "http:\\invalid.url", Headers = new Collection <HttpHeader>() }; target.GetOutOfNetworkProfile(apiRequest); }
protected void sendButton_Click(object sender, EventArgs e) { LinkedInService service = new LinkedInService(base.Authorization); try { console.Text += service.LikeNetworkUpdate(updateKeyTextBox.Text); } catch (LinkedInException lie) { console.Text += lie.Message; } }
private void getConnectionsButton_Click(object sender, EventArgs e) { try { LinkedInService service = new LinkedInService(this.Authorization); ServiceEntities.Connections connections = service.GetConnectionsForCurrentUser(); networkUpdatesGridView.DataSource = connections.Items; } catch (Exception ex) { MessageBox.Show(string.Format("An error occured ({0}).", ex.Message)); } }
protected void Page_Load(object sender, EventArgs e) { LinkedInService service = new LinkedInService(base.Authorization); try { service.CreateShare(console.Text, VisibilityCode.Anyone); } catch (LinkedInException lie) { console.Text += lie.Message; } }
protected void sendButton2_Click(object sender, EventArgs e) { LinkedInService service = new LinkedInService(base.Authorization); try { console.Text += service.CreateShare(string.Empty, titleTextBox.Text, string.Empty, new Uri(submittedUrlTextBox.Text), null, VisibilityCode.ConnectionsOnly, postOnTwitterCheckBox.Checked); } catch (LinkedInException lie) { console.Text += lie.Message; } }
public void GetOutOfNetworkProfile_EmptyUrl_Test() { ILinkedInAuthorization authorization = new LinkedInAuthorizationMock(); LinkedInService target = new LinkedInService(authorization); ApiRequest apiRequest = new ApiRequest { Url = string.Empty, Headers = new Collection <HttpHeader>() }; target.GetOutOfNetworkProfile(apiRequest); }
protected void sendButton_Click(object sender, EventArgs e) { LinkedInService service = new LinkedInService(base.Authorization); try { console.Text += service.CreateReShare(commentTextBox.Text, shareIdTextBox.Text, VisibilityCode.ConnectionsOnly); } catch (LinkedInException lie) { console.Text += lie.Message; } }
protected void sendButton_Click(object sender, EventArgs e) { LinkedInService service = new LinkedInService(base.Authorization); try { console.Text += service.CreateShare(commentTextBox.Text, VisibilityCode.ConnectionsOnly); } catch (LinkedInException lie) { console.Text += lie.Message; } }
protected void sendButton_Click(object sender, EventArgs e) { LinkedInService service = new LinkedInService(base.Authorization); try { console.Text += service.UnlikeNetworkUpdate(updateKeyTextBox.Text); } catch (LinkedInException lie) { console.Text += lie.Message; } }
protected void Page_Load(object sender, EventArgs e) { LinkedInService service = new LinkedInService(base.Authorization); try { NetworkStats networkStats = service.GetNetworkStatistics(); console.Text += Utilities.SerializeToXml<NetworkStats>(networkStats); } catch (LinkedInException lie) { console.Text += lie.Message; } }
protected void Page_Load(object sender, EventArgs e) { LinkedInService service = new LinkedInService(base.Authorization); try { Updates updates = service.GetNetworkUpdates(NetworkUpdateTypes.ApplicationUpdate, 20, 1, DateTime.MinValue, DateTime.MinValue); console.Text += Utilities.SerializeToXml<Updates>(updates); } catch (LinkedInException lie) { console.Text += lie.Message; } }
protected void Page_Load(object sender, EventArgs e) { LinkedInService service = new LinkedInService(base.Authorization); try { Person currentUser= service.GetCurrentUser(ProfileType.Standard); console.Text += currentUser.Name; } catch (LinkedInException lie) { console.Text += lie.Message; } }
protected void Page_Load(object sender, EventArgs e) { LinkedInService service = new LinkedInService(base.Authorization); try { Connections connections = service.GetConnectionsForCurrentUser(); console.Text += Utilities.SerializeToXml<Connections>(connections); } catch (LinkedInException lie) { console.Text += lie.Message; } }
protected void Page_Load(object sender, EventArgs e) { LinkedInService service = new LinkedInService(base.Authorization); try { console.Text += service.InvalidateToken(); Session.RemoveAll(); } catch (LinkedInException lie) { console.Text += lie.Message; } }
protected void sendButton_Click(object sender, EventArgs e) { LinkedInService service = new LinkedInService(base.Authorization); try { List<string> memberIds = new List<string>(); memberIds.Add(Constants.TestMemberId); console.Text += service.SendMessage(subjectTextBox.Text, bodyTextBox.Text, memberIds, includeCurrentUser.Checked); } catch (LinkedInException lie) { console.Text += lie.Message; } }
protected void Page_Load(object sender, EventArgs e) { LinkedInService service = new LinkedInService(base.Authorization); try { // Returns an error Updates updates = service.GetNetworkUpdates(NetworkUpdateTypes.ConnectionUpdate | NetworkUpdateTypes.ChangedAPicture, 20, 0, DateTime.Now.AddDays(-1), DateTime.Now); console.Text += Utilities.SerializeToXml<Updates>(updates); } catch (LinkedInException lie) { console.Text += lie.Message; } }
private void ShowCurrentUserInfo() { LinkedInService service = new LinkedInService(base.Authorization); List<ProfileField> fields = new List<ProfileField>(); fields.Add(ProfileField.PersonId); fields.Add(ProfileField.FirstName); fields.Add(ProfileField.LastName); fields.Add(ProfileField.PublicProfileUrl); Person currentUser = service.GetCurrentUser(ProfileType.Standard, fields); if (currentUser != null) { currentUserHyperLink.NavigateUrl = currentUser.PublicProfileUrl; currentUserHyperLink.Text = currentUser.Name; } }
protected void sendButton_Click(object sender, EventArgs e) { LinkedInService service = new LinkedInService(base.Authorization); try { Person currentUser = service.GetCurrentUser(ProfileType.Standard); string body = string.Format("{0} {1}", currentUser.Name, bodyTextBox.Text); console.Text += service.PostNetworkUpdate("nl-nl", body); } catch (LinkedInException lie) { console.Text += lie.Message; } }
protected void Page_Load(object sender, EventArgs e) { LinkedInService service = new LinkedInService(base.Authorization); try { List<string> memberIds = new List<string>(); memberIds.Add(Constants.TestMemberId); memberIds.Add(Constants.TestMemberId2); People people = service.GetProfilesByMemberIds(memberIds); console.Text += Utilities.SerializeToXml<People>(people); ; } catch (LinkedInException lie) { console.Text += lie.Message; } }
protected void updateButton_Click(object sender, EventArgs e) { try { LinkedInService service = new LinkedInService(base.Authorization); service.CreateShare(statusTextBox.Text, VisibilityCode.ConnectionsOnly); ShowCurrentStatus(); currentStatusLabel.Text = "Your updated status:"; messageLabel.Text = "You successfully updated your status."; } catch (LinkedInException li) { messageLabel.Text = string.Format("An error occured: {0}", li.Message); } messageLabel.Visible = true; }
protected void Page_Load(object sender, EventArgs e) { LinkedInService service = new LinkedInService(base.Authorization); List<ProfileField> fields = new List<ProfileField>(); fields.Add(ProfileField.PersonId); fields.Add(ProfileField.FirstName); fields.Add(ProfileField.LastName); fields.Add(ProfileField.Headline); fields.Add(ProfileField.CurrentStatus); fields.Add(ProfileField.PositionId); fields.Add(ProfileField.PositionTitle); fields.Add(ProfileField.PositionSummary); fields.Add(ProfileField.PositionStartDate); fields.Add(ProfileField.PositionEndDate); fields.Add(ProfileField.PositionIsCurrent); fields.Add(ProfileField.PositionCompanyName); fields.Add(ProfileField.PictureUrl); DisplayProfile(service.GetCurrentUser(ProfileType.Standard, fields)); }
protected void Page_Load(object sender, EventArgs e) { LinkedInService service = new LinkedInService(base.Authorization); try { Uri requestUri = new Uri(Constants.TestApiStandardProfileRequest_Uri); HttpHeader httpHeader = new HttpHeader { Name = Constants.TestApiStandardProfileRequest_HttpHeader_Name, Value = Constants.TestApiStandardProfileRequest_HttpHeader_Value }; Person person = service.GetOutOfNetworkProfile(requestUri, new List<HttpHeader> { httpHeader }); console.Text += Utilities.SerializeToXml<Person>(person); } catch (LinkedInException lie) { console.Text += lie.Message; } }
protected void sendButton_Click(object sender, EventArgs e) { LinkedInService service = new LinkedInService(base.Authorization); try { List<string> memberIds = new List<string>(); memberIds.Add(Constants.TestMemberId); console.Text += service.InvitePerson( emailAddressTextBox.Text, firstNameTextBox.Text, lastNameTextBox.Text, subjectTextBox.Text, bodyTextBox.Text, ConnectionType.Friend); } catch (LinkedInException lie) { console.Text += lie.Message; } }
protected void executeButton_Click(object sender, EventArgs e) { LinkedInService service = new LinkedInService(base.Authorization); try { Updates updates = null; if (scopeCheckBox.Checked) { updates = service.GetNetworkUpdates(NetworkUpdateTypes.All, Scope.Self); } else { updates = service.GetNetworkUpdates(NetworkUpdateTypes.All); } console.Text = Utilities.SerializeToXml<Updates>(updates); } catch (LinkedInException lie) { console.Text += lie.Message; } }
private void ShowCurrentStatus() { LinkedInService service = new LinkedInService(base.Authorization); List<ProfileField> fields = new List<ProfileField>(); fields.Add(ProfileField.PersonId); fields.Add(ProfileField.FirstName); fields.Add(ProfileField.LastName); fields.Add(ProfileField.Headline); fields.Add(ProfileField.CurrentStatus); fields.Add(ProfileField.PositionId); fields.Add(ProfileField.PositionTitle); fields.Add(ProfileField.PositionSummary); fields.Add(ProfileField.PositionStartDate); fields.Add(ProfileField.PositionEndDate); fields.Add(ProfileField.PositionIsCurrent); fields.Add(ProfileField.PositionCompanyName); fields.Add(ProfileField.PictureUrl); Person currentUser = service.GetCurrentUser(ProfileType.Standard, fields); currentStatusLiteral.Text = currentUser.CurrentStatus; }
public void LinkedInServiceConstructorTest() { ILinkedInAuthorization authorization = new LinkedInAuthorizationMock(); LinkedInService target = new LinkedInService(authorization); }
public void PostNetworkUpdate_NoBodyParam_Test() { ILinkedInAuthorization authorization = new LinkedInAuthorizationMock(); LinkedInService target = new LinkedInService(authorization); target.PostNetworkUpdate(string.Empty, null); }
public void Search_ToLargeCount_Test() { ILinkedInAuthorization authorization = new LinkedInAuthorizationMock(); LinkedInService target = new LinkedInService(authorization); Collection<ProfileField> profileFields = new Collection<ProfileField> { ProfileField.SitePublicProfileRequestUrl }; int count = 26; target.Search(string.Empty, string.Empty, string.Empty, string.Empty, true, SortCriteria.Connections, 0, count, profileFields); }