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 🙂

Spider acknowldege SharePoint site


Some weeks back, i finished a project named as Food Connection Pakistan. Its a SharePoint 2010 internet facing site, which got some finest branding and functionality. Even Pakistan famous IT Magzine Spider has some thing to say about this project.

” FC Pakistan is a promising entry on the Web . It has the potential of becoming the ultimate local food guide, provided it works out the kinks.”

To read full article follow this link.

Moreover this site stands tall among the rest of SharePoint site in the month of August 2011 at,

you can read an article about this as well, through this link

It is very nice to see that despite all these mishaps we face in Pakistan, we usually come up some thing different in every aspect of life.


Happy SharePointing

Two ways to Upload file from Client Object Model

Hi Guys,

Just  a quick example, Take a scenario that you are creating an Application (in our case WinForm Application). and you want to upload a document to document library from that application, there are two ways to do, One is to upload from filecreation and the other one is to directly upload with file.savebinary method.

public void uploadfile(string siteurl,string fileName,string libraryName, string subfolderPath)

using (ClientContext clientContext = new ClientContext(siteUrl))

string uploadLocation = string.Empty;
if (!string.IsNullOrEmpty(
{uploadLocation = string.Format("/{0}/{1}/", libraryName, subfolderPath);}
uploadLocation = string.Format("/{0}/", libraryName);

#region Upload through filecreation
var fileCreationInformation = new FileCreationInformation();

byte[] bytefile = System.IO.File.ReadAllBytes(fileName);
fileCreationInformation.Content = bytefile;
fileCreationInformation.Overwrite = true;
uploadLocation = uploadLocation + Path.GetFileName(fileName);
fileCreationInformation.Url = uploadLocation;


#region Uploading directly
using (FileStream fs = new FileStream(fileName, FileMode.Open))

Microsoft.SharePoint.Client.File.SaveBinaryDirect(clientContext, uploadLocation, fs, true);






Please don’t forget to cast your opinion below about this blog
Happy SharePointing,

Default row limit of FullTextQuery or KeyWord Search


Working on search, itself quite challenging but while one is coding against the search API, make the life more miserable.

There is a scenario happen to me recently, while working with  Full Text Query search, my result set remains to be less then 50 rows, which is very suspicious, search crawler working fine plus the search center shows the result nicely, so so..

I have just changed the row limit for my FullTextQuery to 2000 and bingo.

So the lesson from this always check the row limit, and keep to maximum, because 50 is not a good number when you are doing any listing work.


Shakir Majeed Khan