user1648225
user1648225

Reputation: 69

SharePoint Attachments

Can anyone tell me if its possible to get the date an attachment was uploaded on SharePoint? I know how to get the links for the attachments using GetAttachmentCollection(). Does SharePoint save the date which the file was added on?

Thanks

Upvotes: 1

Views: 794

Answers (1)

Ferdinand Prantl
Ferdinand Prantl

Reputation: 5709

Yes, SP saves this information but accessing it is not available in SP client API (WS, CSOM). An attachment is exposed as SPFile by the SP server API, it is retrievable by its web-relative URL by GetFile and you would need one of its properties: TimeLastModified.

Seeing the GetAttachmentsCollection, I guess that you are using WS. You could deploy you custom ASMX or WCF WS to your SP farm providing just the upload time for an attachment URL. You could even create your own alternative of the GetAttachmentsCollection method returning all attachment properties you need in addition to the attachment URL. The former option would minimize the code amount you have to write relying on the OOTB functionality as much as possible, the latter one would give you better performance saving the total client-server call count.

If you cannot deploy a farm solution, services returning JSON or XML can be deployed with a sandboxed solution "concealed" as ASPX pages which would allow you to design such application without involving the farm administrator.

Upvotes: 2

Related Questions