locked
Sharepoint Online rest api: how to get the "AuthorByline" field? RRS feed

  • Question

  • Struggling to understand the arcane thinking behind the author byline field in a news post. This call gets the name in the "created by" field fine, but for news posts I need the "author byline" field:

        https://xxx.sharepoint.com/sites/xxx/_api/web/lists/getbytitle('Site Pages')/items?$select=Title,FileRef,CanvasContent1,Videourl,BannerImageUrl,Author/Title&$expand=Author&$filter=ID eq '193'

    The internal field name is "_AuthorByline" but the response I get is that doesn't exist. Does the field have to be a managed property for the api call to work? 

    I should add that in a search rest api, "Author" returns the "AuthorByline" field, if populated, "created by" if not..

    • Edited by webbrewer Thursday, July 23, 2020 8:46 PM
    Thursday, July 23, 2020 8:46 PM

All replies

  • Hi webbrewer,

    Yo could try this endpoint:

    /_api/web/lists/getbytitle('Site Pages')/items(9)?$select=OData__AuthorBylineId,_AuthorBylineStringId

    Test result:

    This “SharePoint 2013 - Development and Programming” Forum will be migrating to a new home on Microsoft Q&A, please refer to this sticky post for more details.

    Best Regards,

    Amos


    "SharePoint" forums will be migrating to a new home on Microsoft Q&A !
    We invite you to post new questions in the "SharePoint" forums' new home on Microsoft Q&A !


    Friday, July 24, 2020 2:16 AM
  • Thanks Amos. I really need the actual name in the author byline field - any way to get that value?
    Friday, July 24, 2020 4:42 PM
  • Hi webbrewer,

    This endpoint will get author byline field value directly.

    /_api/Web/GetFileByServerRelativePath(decodedurl='/sites/dev/SitePages/news.aspx')/Properties

    Best Regards,

    Amos


    "SharePoint" forums will be migrating to a new home on Microsoft Q&A !
    We invite you to post new questions in the "SharePoint" forums' new home on Microsoft Q&A !

    Monday, July 27, 2020 2:08 AM
  • When I test this with a page that does have a different author byline from the created by user, the response is "the page doesn't exist". 

    Also I can't hard code the page url - it has to be dynamic depending on what the user is looking at.

    Monday, July 27, 2020 3:41 PM
  • Hi webbrewer,

    The screenshot of the test results I shared is a page with different author and author byline value. You could see the different author value and author byline value in the screenshot. You could check if the page url is wrong.

    You could generate the url of the page dynamically and put it into rest api.

    What is the specific usage scenario? If you need further help, please share more information. 

    Best Regards,

    Amos


    "SharePoint" forums will be migrating to a new home on Microsoft Q&A !
    We invite you to post new questions in the "SharePoint" forums' new home on Microsoft Q&A !

    Tuesday, July 28, 2020 6:27 AM
  • I'm building a mobile app in react native that gives users access to curated intranet content. Using the search rest api for groups of news pages, the web api for individual posts. Search returns the "author byline" field correctly, web does not. 
    Tuesday, July 28, 2020 1:25 PM
  • Hi,

    Could you share the search rest api and web api which you used?

    And I still do not understand your requirement fully. Where do you want to use the author byline value?

    Best Regards,

    Amos


    "SharePoint" forums will be migrating to a new home on Microsoft Q&A !
    We invite you to post new questions in the "SharePoint" forums' new home on Microsoft Q&A !

    Wednesday, July 29, 2020 9:54 AM
  • Sure - the web api is as posted above (gets specific fields from 1 news article ):

    https://xxx.sharepoint.com/sites/xxx/_api/web/lists/getbytitle('Site Pages')/items?$select=Title,FileRef,CanvasContent1,Videourl,BannerImageUrl,Author/Title&$expand=Author&$filter=ID eq '193'

    Search api (gets 5 most recently published articles from 3 sites):

    https://xxx.sharepoint.com/_api/search/query?querytext='IsDocument:True AND FileExtension:aspx AND PromotedState:2 Path:https://xxx.sharepoint.com/sites/xxx Path:https://xxxx.sharepoint.com/sites/xxx Path:https://xxx.sharepoint.com/sites/xxx-in-the-news'&sortlist='FirstPublishedDate:descending'&startRow=0&rowlimit=5&selectproperties='Title,Description,Author,FirstPublishedDate,PictureThumbnailURL,WebId'

    I have a react native mobile app that is populated with these calls - the web api provides full article content, the search api provides select content to a landing page showing the 5 most recent articles.



    • Edited by webbrewer Wednesday, July 29, 2020 5:49 PM
    Wednesday, July 29, 2020 5:47 PM
  • Hi,

    /_api/web/lists/getbytitle('Site Pages')/items(9)?$select=OData__AuthorByline/Title&$expand=OData__AuthorByline

    This endpoint can also get author byline property.

    Best Regards,

    Amos


    "SharePoint" forums will be migrating to a new home on Microsoft Q&A !
    We invite you to post new questions in the "SharePoint" forums' new home on Microsoft Q&A !

    Friday, July 31, 2020 9:52 AM