.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Post New Web Links

View previous version of a file in document library using Client Object Model

Posted By:      Posted Date: September 27, 2010    Points: 0   Category :SharePoint
 

Hi,

 

Using Server-side object model, it is pretty simple to get the previous file versions. Say I wanted to view a file in its initial version, all I’d need to do is :

 

file.Versions[0].File

 

When using Client object model, I couldn’t any analogous method/property which would let me fetch the previous version of file.

Can somebody point me to a sample or the property which would serve my purpose?




View Complete Post


More Related Resource Links

Silverlight client object model : Read a document from a document library

  
How do I read/download a document/file from a SharePoint document library using silverlight client object model? The most closest function that I found was: Microsoft.SharePoint.Client.File.OpenBinaryDirect() but this seems to be throwing an exception "Operation not supported".

View Definition for SP 2010 Client Object Model

  
Hello, I am looking for where in the SP Client Object Model that I would find where the View Definitions are Located. For various reasons, I am displaying in my own custom listview a list of Documents and I would like these list results to share the same look as if the user was looking at the list in SharePoint.Please note this is NOT web based, but an application. Can someone give me a hint as to how to pull a view definition? Thanks, Andrew

Extract document for a SPListItem from a Document Library using the Object Model

  

WSS 3.0

I want to use the object model to extract the document from a Document Library. I am doing a foreach(SPListItem item in docLib).

How can I use SPListItem to get the document for that item?


Document Library version restore not behaving as expected on the "Name" column (file name)

  

After a rollback to a previous version, the value of the column "Name" in a document library is not restored. All other columns are restored properly. It seems that the column "Name" (file name) is excluded from the process of versioning.

I didn't find information on this behaviour on the internet. Any suggestions ?

Thanks


Restore a previous version of a document in a document library - error

  
  When I try to restore a previous version of a document in a document library, I get this error message:

"Updates are currently disallowed on GET requests. To allow updates on a GET, set the AllowUnsafeUpdates' property on SPWeb"

I am NOT running any custom code anywhere on my SharePoint site 

Add a new link to a document using the client object model

  

I need to add a new document link to a document library using the client object model. What I want to do is the same as the code sample below but instead of creating a new document I want to create a new link to a document.

ClientContext context = new ClientContext("http://wdev2008:22880");
context.Load(context.Web);
List list = context.Web.Lists.GetByTitle("Test Doc Link Library");
context.Load(list);context.ExecuteQuery();

FileCreationInformation fileCreateInfo = new FileCreationInformation();
fileCreateInfo.Content = new byte[] { 0x33 };
fileCreateInfo.Url = "zerobyte";
File file = list.RootFolder.Files.Add(fileCreateInfo);
context.Load(file);context.ExecuteQuery();

Thanks,

Aaron


How to get Audit/History Log of Document using Client Object Model 2010?

  

I want to get the history/audit log of particular Document in my Library. When was it updated, who did checkin/checkout  on which date on this file?

 

Is there a way to get these information using Client Object Model?


Ronak Patel

how to extract the files from the document library using object model

  

Hi,

I need to extract the files from the document library using object model in sharepoint 2007.

Can anyone help me.

Regards,

Jyoshna


Jyoshna

How to get Audit/History Log of Document using Client Object Model 2010?

  

I want to get the history/audit log of particular Document in my Library. When was it updated, who did checkin/checkout  on which date on this file?

 

Is there a way to get these information using Client Object Model?


Ronak Patel

Recover last version of file properties in MOSS document library

  

After an overwrite to several hundred files we need a quick way to either restore the entire file to the previous version or ideal just the custom property fields.

I tried to find a way to script a query into the document library and collect the previous version custom data into an excel spreadsheet but could not find a solution.

I came across this post that indicated he was able to restore only the file properties but retained the current version (which was not his gold but would be mine).

http://www.sharepointoverflow.com/questions/1184/sharepoint-document-library-version-restore-not-behaving-as-expected

He included a snippet of his code:

Would this work? is there a powershell equivalent?

Whats the easies way to make this code into a useful solution.

 

int versionCount = item.Versions.Count;
if (versionCount > 0)
{
 
// this only restores properties
 item

Using the Client Object Model to read values from Excel file produces 504 error

  

Hi,

I use the Client Object Model to retrieve and read values from an Excel file. This is triggered in an Event Receiver on the Document Library where the Excel file lives. I use a simple CAML Query to retrieve the file. This has worked just fine on a dev/test server. 
Now, I just recently deployed this solution to a production/live server and now this code doesn't work anymore. I get an error saying 'The remote server returned an error: (504) Gateway Timeout'. This happnes when I try clientContext.ExecuteQuery();

The difference between the two servers is that on the test server (where it works) the solution is sitting as the root site, so to speak. No host headers or nothing.
On the live server, there are several web applications (SharePoint) on the same port, but with different host headers.

I have tried to trace a little bit and I found that on the test server, the url that is used to create the ClientContext object is 'http://<servername>/<webname>'. The url is comes from the following code: web.Url. I tried changing the url to the DNS name the test server has and that resulted in the same error as on the live server.

Does anyone have any idea what I need to do?

Thanks a billion!


Upload a File to a SharePoint Document Library - Part I

  
The following helper class demonstrates a few techniques that allow documents to be uploaded to a SharePoint document library programmatically without using the API or a custom web service. You don't need to specify a document library name, and it will create any folders specified in the URL as required. File meta data will be updated if any properties are passed.

File Attachments from info-path forms to Sharepoint document library

  

Hi Experts,

How to upload file attachements from info-path forms to Sharepoint document library?

I need to add attachement from local-PC/Any User to Sharepoint Document Library.

 

Any help please?? Appreciated

 

Regards,

Kumar


When try to open a folder in a moss 2007 document library in Explorer View, the folder does not open

  

When try to open a folder in a moss 2007 document library in Explorer View, the folder does not open.

I am using IE7 and the path of the folder does not contains more than 100 characters.

Also it opening on few on the machines which has IE7.

Help.. 


Reg File Upload control to upload files from document library

  
Hi,

In Field Upload control if we click browse button it allow us to search file in our hard disk but now as per my requirement as soon as user clicks ‘Browse’ button it should point to the document libraries and their files in site.Let me know how could i achieve this?
 

Thanks & Regards,
 

Sudheer

Client Object Model Resource Center | SharePoint 2010

  
Are you creating client applications that access SharePoint data remotely? Find overviews, guidelines, and programming tasks for all three flavors of the SharePoint Foundation client object model: .NET managed, Silverlight, and ECMAScript.

Quick Note: Building WPF Applications by Using the SharePoint 2010 Client Object Model

  
Learn how to create a Windows Presentation Foundation (WPF) application that uses the SharePoint 2010 client object model to retrieve data from a SharePoint Web site.
Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend