Quantcast
Channel: SharePoint 2010 - Development and Programming forum
Viewing all articles
Browse latest Browse all 11571

Name cannot begin with the '\"' character, hexadecimal value 0x22

$
0
0

I am trying to create Calculated Column in SharePoint Document Library using Client Object Model.

However getting following error while executing FieldSchema:

Name cannot begin with the '\"' character, hexadecimal value 0x22

Code:

 var calculated = "Calculated";
 var displayName = "Effective Date";
 var internalName = "Effective Date";
 var formula = "=IF(ISBLANK(Col_DocumentEffectiveDate),\"\",TEXT(Col_DocumentEffectiveDate,\"DD-Mmm-YYYY\"))";
 List lib = clientContext.Web.Lists.GetByTitle(docLibName);
 clientContext.Load(lib);
 clientContext.ExecuteQuery();
                
string fieldSchema = "<Field Type=\"" + calculated + "\" DisplayName=\"" + displayName + "\" Name=\"" +internalName+ "\" Formula=\"" + formula + "\" />";
lib.Fields.AddFieldAsXml(fieldSchema, true, AddFieldOptions.AddFieldInternalNameHint);
clientContext.ExecuteQuery();

Code does't work if i replace quotation marks("\) in Formula with "&quot;"

Could someone help with issue?


Viewing all articles
Browse latest Browse all 11571

Latest Images

Trending Articles



Latest Images