0

I have a SharePoint list and the items within this list have one or more files attached. I need to mirror/ replicate these attachments to a client’s document repository.

To this end, I am trying to determine

  1. The attachments created date/ time (when the file was attached to the list item)
  2. The attachments last modified date/time
  3. The attachments GUID/ ID (I need a primary key to identify the document)

I am somewhat new to the SharePoint API and am struggling a little! I have tried the call below, but it does not contain the information I am looking for. Can anyone suggest a call or endpoint that might return what I’m looking for?

http://mysite/_api/lists/getByTitle('MyList')/items?$expand=AttachmentFiles

1 Answer 1

0

I don't think that this would solve the problem of getting an Id/GUID but you could use

http://mysite/_api/web/getfilebyserverrelativeurl('ServerRelativeUrl') 

to get the created date/time and modified date/time of the attachment. You would have to make this call for each individual attachment though. For a normal SharePoint file you could append /ListItemAllFields to the end of the url, which would allow you to get the ID, but it appears ListItemAllFields is null for attachments.

2
  • Hi James- this is perfect and does indeed return the files GUID. Commented Apr 21, 2017 at 15:08
  • Glad it worked for you! I think the GUID is returned in SharePoint Online but isn't returned if you are using SharePoint Server 2013 Commented Apr 21, 2017 at 15:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.