After creating a form in InfoPath and publishing it to SharePoint, I can use Microsoft.SharePoint.Client to retrieve all the items from my document library using the following Key strings:

const string FirstName = "FirstName";
const string MiddleInitial = "_3f304008_6d27_46e4_82e1_81d2ea5d5d84";
const string LastName = "__x007b_39b5c34f_247a_466c_8a76_480f54461087_x007d_";
const string Role = "__x007b_c0bc5325_2cdb_4b7d_8687_eba9cf958f01_x007d_";
const string Department = "Department";
const string JobTitle = "JobTitle"; // __x007b_c0bc5325_2cdb_4b7d_8687_eba9cf958f01_x007d_
const string Office = "";
const string ReportingTo = "_398dc3c8_ff1d_4013_a6e0_139809b37b0d";
const string SecretaryTo = "_cefdf77c_5767_4539_aa5b_098aa3ff0b60";
const string StartDate = "StartDate";
const string FullTime = "_96d926ba_0a82_4773_964a_43d884e5d6d4";

Then, while iterating around each SPListItemCollection from the Document library:

var firstName = item.FieldValues[FirstName];
var middleName = item.FieldValues[MiddleInitial];
var lastName = item.FieldValues[LastName];
var role = item.FieldValues[Role];
var department = item.FieldValues[Department];
var jobTitle = item.FieldValues[JobTitle];          
var office = item.FieldValues[Office];              
var reportingTo = item.FieldValues[ReportingTo];
var secretaryTo = item.FieldValues[SecretaryTo];
var startDate = item.FieldValues[StartDate];
var fullTime = item.FieldValues[FullTime];

var metaData = item.FieldValues["MetaInfo"];

This method works fine for all of the fields except for Office, which for some reason is not available under FieldValues except for inside MetaInfo

As you can see, not all of the field names have been sent to SharePoint with their proper names (e.g. "FirstName" and "_3f304008_6d27_46e4_82e1_81d2ea5d5d84").

I promoted these fields to SharePoint by:

  1. File -> Publish -> Publish Form to SharePoint Library
  2. When asked which fields I want to promote, I selected those mentioned above.
  3. Under "Site Column Group", I select (None: Create new column in this library)
  4. After activating the form, I can access the fields via SharePoint Designer and C#

I have 2 questions:

  1. Why do some of my fields have friendly names, while others seem more like long ID strings?
  2. What reason would there be for the Office field to not promoting properly? I can't see it in my FieldValues except for the MetaInfo field, which contains all InfoPath fields. Note that Office is a simple drop-down box in InfoPath, similar to Role which works perfectly.

Many thanks for all your help.


This was being caused because when I originally promoted the field, there already existed a Managed Metadata field in that group with the same name - Office.

After renaming the group and promoting it again, I am able to access it in the code with


And now, when I look in the FieldValues I can see that there is an empty Office field.

I still don't understand what is going on here but at least I managed to fix the problem.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.