You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.
pnp / pnpjs Public
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Thank you for reporting an issue, suggesting an enhancement, or asking a question. We appreciate your feedback - to help the team understand your
needs please complete the below template to ensure we have the details to help. Thanks!
Please check out the Docs to see if your question is already addressed there. This will help us ensure our documentation covers the most frequent questions.
Please specify what version of the library you are using: 1.1.2
Add a column to a list.
Attempting to add multiple columns to a list in a set of Promise.all() calls, many throw an error - body contents:-
Trying to create columns on a new list:-
retvar.push(sp.web.lists.getById(listID).fields.addText("Department", 255, < Description: "Department of person making request.", EnforceUniqueValues: false, Required: true, DefaultFormula: '' >)); return Promise.all(retvar);
I am setting multiple headers as per previous issues found online:-
sp.setup( < sp: < fetchClientFactory: () =>< return new SPFetchClient(config[rtFlag].siteURL, config[rtFlag].appID, config[rtFlag].appSecret); >, headers: < "accept": "application/json;odata=verbose", "content-type": "application/json;odata=verbose", "odata-version": "3.0", "UserAgent": "ISV|OurCompany|ListCreator/1.0" >>, >);
The text was updated successfully, but these errors were encountered:
patrick-rodgers added type: question area: documentation status: details needed labels Jul 20, 2018 patrick-rodgers commented Jul 22, 2018As mentioned by @koltyakov this is an issue on the server where you are essentially in a race condition. When the two updates hit at the same time one gets through and the other is blocked because the underlying object was updated after the reference was created on the server. I was also able to add multiple fields at once using batching as below:
const web = sp.web; const batch = web.createBatch(); const list = web.lists.getByTitle("Issue172"); list.fields.inBatch(batch).addText("Text1"); list.fields.inBatch(batch).addText("Text2"); list.fields.inBatch(batch).addText("Text3"); list.fields.inBatch(batch).addText("Text4"); list.fields.inBatch(batch).addText("Text5"); batch.execute().then(_ => console.log("done"));