Filter the list fields by writing following code using System; using Microsoft.SharePoint.Client.
Up vote 0 down vote favorite share g+ share fb share tw.
I'm building a Sharepoint 2010 export tool for back up reasons (a bit like the filemanager from Metavis). When downloading a file to local disk I need to back up the metadata associated with the document. Which I will store in a csv-file.
My first approach was to iterate all listItem. Fieldvalues, but that doesn't really work because some fieldvalues are complex types, which would needlessly complicate the backup file. Some values even have line endings, for example "MetaInfo".
Furthermore not all values are needed to restore the content when that might be necessary. So my idea is to only get the values from the Fieldvalues collection which are needed to do a functional restore, supplemented with all the user added metadata. To do this I want to check all fieldvalues against an exclusion list to see if it is present.
If it is present don't back up. If it is it is either user generated metadata or a value I need like for instance "author", "created". So my question is, does anyone know of a list of all fieldvalues keys?
Or is there a better approach to my problem? Thanks Update: Well, as I was iterating through the FieldValues collection any way. It was easy to do a dump of all the values to a CSV.
Running it once was enough to get all the values. Now all I need to write is an xml file for configuration. This leaves the question: is there a better way of doing this?
Sharepoint2010 sharepoint-clientobject link|improve this question edited Oct 10 '11 at 12:06 asked Sep 29 '11 at 8:30BetaUser225 100% accept rate.
Filter the list fields by writing following code using System; using Microsoft.SharePoint. Client; clientContext. Load( listItems, items => items .
Include( item => item"Title", item => item"Category", item => item"Estimate")); Source: http://msdn.microsoft.com/en-us/library/ee857094.aspx#SP2010ClientOM_Creating_Windows_Console_Application You can create an view with all fields, get the view using sharepoint object model and and get its column name from collection and filter them as per your requirement.
I did use the Client Object Model. As far as I can judge from your code snippet there is still some configuration needed; when retrieving items with a string, this string has to be known somehow. Which gets us back to the beginning.
How to know all values? – BetaUser Dec 14 '11 at 9:17.
I have finished the application. As I wrote in my update I have made a list of all fieldValues by exporting them to a CSV file. After that I made a configuration-file with a boolean 'Backup'.
This makes it possible to control which values are to be used when a backup is made. I retrospect I think a configuration file was not needed. The values used when backing up are so much part of the whole workings of the program that a configuration file gives an administrator or casual future developer the impression that a simple reconfiguring will fulfill there needs.
I can now see that if the program needs to change due to new requirements the code has to be changed anyway. So even though setting a value to 'True' will change the output. Some other code has to be written as well.
If I were to write it again I would probably use constants. This makes it all less dynamic, but still fulfill the needs of the program. (BTW a list of all the names off the standard fieldValues would have been nice to start with.
I would publish it here, but I don't have access to the file anymore, because I switched jobs recently. ).
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.