Skip to content

Page LikeByInformation - Page.GetLikedByInformationAsync() is not retreiving any information about page likes #1395

@NishkalankBezawada

Description

@NishkalankBezawada

Category

  • Bug

Describe the bug

I am trying to get the Page LikedByInformation as below,

var pageLikeInformation = clientSidePage.GetLikedByInformationAsync().GetAwaiter().GetResult();

But i get no results when using this.

I also used GetCommentsAsync() to get the comment collection which works fine.
var commentsCollection = clientSidePage.GetCommentsAsync().GetAwaiter().GetResult();

Below code is working and getting likedByInformation as well.
`
var pageNew = await pnpContext.Web.NewPageAsync();

            // Save the page
            await pageNew.SaveAsync("Pageb.aspx");

            // Publish the page, required before it can be liked
            await pageNew.PublishAsync();

            // Like the page
            await pageNew.LikeAsync();

            var pageLikeInformation = await pageNew.GetLikedByInformationAsync();
            bool pageLikedByCurrentUser = pageLikeInformation.IsLikedByUser;
            foreach (var likedByUser in pageLikeInformation.LikedBy.AsRequested())
            {
                // do something with the information about the user who liked this page
            }

`

Below code is not working,

`
var mypages = await pnpContext.Web.GetPagesAsync("TestingLikeInfo.aspx");
var pageABC = mypages.First();

            await pageABC.PublishAsync();
            ILikedByInformation likeInfo2 = await pageABC.GetLikedByInformationAsync();
            bool pageLikedByCurrentUser2 = likeInfo2.IsLikedByUser;

`

Expected behavior

await pageABC.GetLikedByInformationAsync(); should get LikedByInformation

Library

PnP.Core - 1.11.69-nightly

Thanks,
Nishkalank

Metadata

Metadata

Assignees

Labels

area: model 📐Related to the core SDK modelsquestionFurther information is requested

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions