In a particular project I am required to retrieve corresponding attachments to a request submitted by a user. On one page the live requests are displayed with links to the attachments.

The project set up retrieved all the attachments name and id from the document library and queried against this using LINQ.

I have been asked to optimise the solution and identified this as possible bottleneck. My rewrite now queries this document library for each live request, only retrieving the items that correspond.

My question is, is this more efficient to open the web and query the document library when required, or to retrieve every existing attachments details and filter this using LINQ.

The list will, in time, be holding 1000's of attachments.

1 Answer 1


Hopefully you do LinqToSharepoint in the correct way. However, I guess, you have a List where the requests itself are contained My Question is: Why don´t you activate Attachments for that list? That way you have all the necessary files attached to the corresponding request-Item and do not have to make an separate Request

  • 2
    as tested here: blog.metrostarsystems.com/2011/10/25/… you can see that Linq is the slowest way to query against SharePoint lists (even if you use it correct). If you have a performance-Problem, refactor your queries to use caml directly Aug 17, 2015 at 13:26

Your Answer

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

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