I have created below function in separate library to create list and its 3 fields in the react project, however, its working with normal character SharePoint list but not with special characters list e.g Employee`~!@#$%^&*()_+=-,.<>?;:"[]{}|. System created special character SharePoint list but don't added three fields and throwing error:

isHttpRequestError: true


Response {type: "default", url: "", redirected: false, status: 400, ok: false, …}

status: 400

statusText: "Bad Request"

message: "Error making HttpClient request in queryable [400] Bad Request ::> 
{"odata.error":{"code":"-1, Microsoft.SharePoint.Client.InvalidClientQueryException",
"message":{"lang":"en-US","value":"The expression \"web/lists/getByTitle('~!@\" is not valid."}}}"

public async CreateList(listTitle: string, siteURL: string, listDescription: string, fields: any[], isHidden: boolean = true) {

return new Promise<any>(async (resolve, reject) => {

try {

let _web = new Web(encodeURI(siteURL));

// let _listName = this.utilityService.DecodeString(this.utilityService.decodeSpecialCharacters(listTitle));

var createListAddResult: ListAddResult = await _web.lists.add(listTitle, listDescription, 100, false, { 'Hidden': false });


if (createListAddResult.list != null) {

let listfieldsaddBatch = _web.createBatch();

//add fields to list

fields.map(field => {

if (field.FieldTypeKind == FieldTypes.Text) {

createListAddResult.list.fields.inBatch(listfieldsaddBatch).addText(field.title, 255);


if (field.FieldTypeKind == FieldTypes.Note) {

createListAddResult.list.fields.inBatch(listfieldsaddBatch).addMultilineText(field.title, 100, false, false, false, false);


if (field.FieldTypeKind == FieldTypes.Boolean) {




await listfieldsaddBatch.execute();

let listfieldsinViewBatch = _web.createBatch();

fields.map(field => {



await listfieldsinViewBatch.execute();



} catch (ex) {





  • It's a SharePoint standard to not use special characters anywhere in List/column/folder names. What is the issue? Nov 24, 2019 at 8:56
  • Its client requirement, the function is written in separate library, and when its called in the project, its throwing error " Bad Request ::> {"odata.error":{"code":"-1, Microsoft.SharePoint.Client.InvalidClientQueryException" Nov 24, 2019 at 15:25


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.