none
Client object model vs Server object model - FileInformation object RRS feed

  • Question

  • Hi,

    I have a piece of code that opens an Excel document sitting in a document library. The developer who wrote the code uses the Client Object Model to retrieve the file. Now, this causes some problems on the production server.

    I'm trying to look into using the server object model instead, but I can't seem to find the server object that is the 'same' as the client object FileInformation. 

    Does anyone know?

     

    Thanks!

    Friday, November 26, 2010 1:32 PM

Answers

  • Hi R,

    FileInformation, correlates the file information on the client with the file information on the server.

    http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.client.fileinformation_members.aspx

    Im assuming that you want to get a stream from a Document inside sharePoint right?

    Do like this:

    //Get file from SPWeb
    SPFile file = web.GetFile(fileUrPath);

    //Get Stream from file
             
    using (StreamReader fileStream= new StreamReader(file.OpenBinaryStream()))
    {
     //use fileStream to do what you want
    }

     

    Hope it helps

    Rodrigo Pinto,SharePoint Specialist, Evangelist
    http://www.sharepointpt.org
    SharePointPt Founder
    @Scoutmanpt
    PS- If you think reply answer your question, propose as an answer

    • Marked as answer by Wayne Fan Thursday, December 2, 2010 3:15 AM
    Saturday, November 27, 2010 2:40 AM