我正在使用Javascript創建一個列表。但同時加入欄列出它越來越錯誤Sharepoint - Uncaught TypeError:無法設置屬性'newColumns'undefined
function createlist() {
// Create a generic SharePoint list with the name that the user specifies.
var listCreationInfo = new SP.ListCreationInformation();
var listTitle = "MyList";
listCreationInfo.set_title(listTitle);
listCreationInfo.set_templateType(SP.ListTemplateType.genericList);
lists = web.get_lists();
var newList = lists.add(listCreationInfo);
var newCols = [ "<Field Name='PageText' DisplayName='Page Text' Type='Note' RichText='TRUE' RichTextMode='FullHtml' NumLines='10' />",
true];
var numberCols = newCols.length;
for (var i = 0; i < numberCols; i++) {
this.newColumns= newList.get_fields().addFieldAsXml(newCols[i],true,SP.AddFieldOptions.defaultValue);
}
context.load(numberCols);
context.executeQueryAsync(onListCreationSuccess, onListCreationFail);
}
Uncaught TypeError: Cannot set property 'newColumns' of undefined
createlist @ App.js:57
(anonymous function) @ App.js:18
b.Callbacks.c @ jquery-1.9.1.min.js:3
b.Callbacks.p.fireWith @ jquery-1.9.1.min.js:3
b.extend.ready @ jquery-1.9.1.min.js:3 H @ jquery-1.9.1.min.js:3
幫我我在哪裏犯錯