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
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.

  • Hi James- this is perfect and does indeed return the files GUID. – Monte_fisto Apr 21 '17 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 – James11 Apr 21 '17 at 15:20

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.