How to find the Listitem metadata info Client Object Model

Yesterday, some one on my last blog   Two ways to Upload file from Client Object Model , asked how to find out the metadata info of the file from COM.

So the following code  give you the general idea how to find out that metadata info of the file from Client Object Model

ClientContext cc = new ClientContext("http://server:5421");
Web web = cc.Web;
string webName = web.Title;
string uploadLocation = string.Empty;

List list = cc.Web.Lists.GetByTitle("Documents");
ListItem item;

// this is how you can get the item(file), you can also use CAML query
cc.Load(item = list.GetItemById(22));

//here you can get the dictonary for fieldvalue

string createdby = item.FieldValuesAsText["Created_x0020_By"];
string modifiedby = item.FieldValuesAsText["Modified_x0020_By"];

Enjoy 🙂

Happy SharePointing 🙂


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s