1

I'm just getting into using REST calls to work with SharePoint 2013. The first challenge I'm facing is know which columns I can retrieve using $select and which ones need to be expanded.

For example I'm using the document id services and want to retrieve the document id. I tried $select="DocId" but that didn't work. Eventually I noticed somewhere that it is OData__dlc_DocId. How would I have ever guessed that?

I know how to look up the internal name for columns that we've created, but I don't know how to find these names for other built in properties.

Is there a list of these somewhere?

Also is there a list which ones need to be expanded?

1

I too am in the early months of using the SharePoint (Online) REST APIs and on the whole are liking the experience.

A browser add-in I've found very useful to expand the results of and debug REST API calls is http://restclient.net/

Once I know I've got a successful call, I've found it straightforward to drill down into the results using the d.results[n] syntax

Update: So, I've done some more research now I see you are working with a document library and looking for document properties...

I turns out that the REST URL is slightly different for querying document properties: https://mysharepointsite/sites/site_name/_api/web/getfilebyserverrelativeurl('/sites/site_name/Document Library Name/File Name.suffix')

For me, this query returns the following fields:

"CheckInComment": "",
"CheckOutType": 0,
"ContentTag": "{9874C2F2-DB89-4604-BD13-32E30F5176D2},2,5",
"CustomizedPageStatus": 0,
"ETag": "\"{9874C2F2-DB89-4604-BD13-32E30F5176D2},2\"",
"Exists": true,
"IrmEnabled": false,
"Length": "9117",
"Level": 255,
"LinkingUrl": "",
"MajorVersion": 1,
"MinorVersion": 0,
"Name": "lifing hazard.jpg",
"ServerRelativeUrl": "/sites/dev/Skills Training Images/lifing hazard.jpg",
"TimeCreated": "2014-03-17T00:30:10Z",
"TimeLastModified": "2014-03-17T00:30:53Z",
"Title": "Excessive Weight",
"UIVersion": 512,
"UIVersionLabel": "1.0",
"UniqueId": "9874c2f2-db89-4604-bd13-32e30f5176d2"

where 'Length' is the file size in bytes.

MSDN Source - https://msdn.microsoft.com/en-us/library/office/dn450841.aspx

  • That link doesn't work for me. But I don't think every possible field is returned unless you ask for it, right? So if you don't know what it is called, how could you drill down to find out what the name is? – Rothrock Feb 6 '16 at 0:10
  • Not sure why the link didn't work, but its by no means the only REST query add-in out there; probably worth a search around and find one that 'does it' for you. – Fairfield Feb 6 '16 at 21:10
  • As far as REST syntax/results go, eg. https://mysite/sites/dev/_api/web/lists/getbytitle('mylist')/Items?$filter=ID eq '186' give me all fields - custom & built in columns - which I can then extract using 'd.results.fieldname'. Using the browser dev tools with a well-positioned breakpoint has allowed me to query the result in real-time. – Fairfield Feb 6 '16 at 21:16
  • I tried this and it is very helpful--thank you. But it doesn't include all the built in properties. For example I know that there is a FileRef and FileLeafRef, but those are not in the returned data. – Rothrock Feb 9 '16 at 19:44
0

I did find this post. Don't know if it is complete or up to date. Fixe Size and Source URL didn't work for me.

Name FileLeafRef Name LinkFilenameNoMenu Name LinkFilename Name BaseName URL Path FileRef Path FileDirRef File Size File_x0020_Size File Type File_x0020_Type Source Url _SourceUrl Type DocIcon Name FileLeafRef Title Title Order Order HTML File Type HTML_x0020_File_x0020_Type URL Path FileRef Created Created_x0020_Date File Size File_x0020_Size File Type File_x0020_Type File Name BaseName Created By Author Modified By Editor

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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