Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

My question is very simple. I would like to display the recent top 10 news with the REST API in Sharepoint 2013. I'm using the following query:

http://my-server/my-news/_api/web/lists/GetByTitle('Pages')/items?$select=Id,Name,Title,Comments&$orderby=ArticleStartDate%20desc&$top=10&$filter=Title+ne+'Home'

Now I would like to select the link to the news page. But as far as I know, there is no property that I can get that would give me the URL of the page.

Anyone knows a way, via the REST query, to get the URL? Thanks!

share|improve this question

2 Answers 2

up vote 1 down vote accepted

Have you tried getting the column 'FileRef'?

If not can you construct the URL using the Name?

share|improve this answer
    
Wonderful, FileRef is working. Thank you so much! (Might want to edit your post from FieldRef to FileRef) –  Simon Lapointe Jan 23 at 21:16
    
Here is the link for FileRef: msdn.microsoft.com/en-us/library/… –  Russell Jan 24 at 0:30

FileRef field in $select query option will return page url.

For example, the query:

https://fabrikam.sharepoint.com/_api/web/Lists/getbytitle('Pages')/items?$top=1&$select=Id,Title,FileRef

will return:

    <?xml version="1.0" encoding="utf-8"?>
<feed xml:base="https://fabrikam.sharepoint.com/_api/" 
    xmlns="http://www.w3.org/2005/Atom" 
    xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" 
    xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" 
    xmlns:georss="http://www.georss.org/georss" 
    xmlns:gml="http://www.opengis.net/gml">
    <id>07244208-09fa-4014-bd1f-785a73b8d4a1</id>
    <title />
    <updated>2014-01-23T21:14:58Z</updated>
    <entry m:etag="&quot;5&quot;">
        <id>78183075-e864-4e76-8efb-38bf6e2190f9</id>
        <category term="SP.Data.PagesItem" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
        <link rel="edit" href="Web/Lists(guid'a976fb47-81fa-47ae-a487-7d6d656a54ce')/Items(1)" />
        <title />
        <updated>2014-01-23T21:14:58Z</updated>
        <author>
            <name />
        </author>
        <content type="application/xml">
            <m:properties>
                <d:Id m:type="Edm.Int32">1</d:Id>
                <d:Title>Home</d:Title>
                <d:ID m:type="Edm.Int32">1</d:ID>
                <d:FileRef>/Pages/default.aspx</d:FileRef>
            </m:properties>
        </content>
    </entry>
    <link rel="next" href="https://fabrikam.sharepoint.com/_api/web/Lists/getbytitle('Pages')/items?%24skiptoken=Paged%3dTRUE%26p_SortBehavior%3d0%26p_ID%3d1&amp;%24top=1&amp;%24select=Id%2cTitle%2cFileRef" />
</feed>
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.