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; cc.Load(web); cc.ExecuteQuery(); string webName = web.Title; string uploadLocation = string.Empty; List list = cc.Web.Lists.GetByTitle("Documents"); cc.Load(list); cc.Load(list.ContentTypes); cc.Load(list.Fields); 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 cc.Load(item.FieldValuesAsText); cc.ExecuteQuery(); string createdby = item.FieldValuesAsText["Created_x0020_By"]; string modifiedby = item.FieldValuesAsText["Modified_x0020_By"];
Enjoy 🙂
Happy SharePointing 🙂
Hi Shakir,
It is nice to read your blog. I wasnt aware of “cc.Load(item = list.GetItemById(22)); ” syntax. One more thing, are you using FieldValuesAsText just to make lightweight and easy data type handling? How about payload just because you are fetching all field values.