admin管理员组文章数量:1123591
I am new to the topic of SharePoint access / JavaScript and a bit overwhelmed. I have a SharePoint list that I would like to fill with entries using JavaScript. The list only has the title column at the moment
I have a small test script that I would like to extend with an input field, the content of which is then stored in the list. What do I have to add to it to fill the list?
<body>
<h1>Das ist Ein Test. Anscheinend hat es geklappt.</h1>
<button onclick="closePage()">Bestätigen</button>
</body>
<script>
var loc = window.location.href;
const urlParams = new URLSearchParams(loc);
var tableDisplayName = urlParams.get("tableDisplayName");
var tablePathName = urlParams.get("tablePathName");
var id = urlParams.get("id");
var action = urlParams.get("action");
var customFields = null;
if(loc.indexOf("customfields") != -1) {
customFields = JSON.parse(urlParams.get("customfields"));
}
SP.SOD.executeOrDelayUntilScriptLoaded(retrieveListItems, "sp.js");
function retrieveListItems() {
alert("Script loaded successfully!"); // Popup-Fenster zum Testen
}
function onQueryFailed(sender, args) {
alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());
}
function closePage() {
window.close();
}
</script>
I am new to the topic of SharePoint access / JavaScript and a bit overwhelmed. I have a SharePoint list that I would like to fill with entries using JavaScript. The list only has the title column at the moment
I have a small test script that I would like to extend with an input field, the content of which is then stored in the list. What do I have to add to it to fill the list?
<body>
<h1>Das ist Ein Test. Anscheinend hat es geklappt.</h1>
<button onclick="closePage()">Bestätigen</button>
</body>
<script>
var loc = window.location.href;
const urlParams = new URLSearchParams(loc);
var tableDisplayName = urlParams.get("tableDisplayName");
var tablePathName = urlParams.get("tablePathName");
var id = urlParams.get("id");
var action = urlParams.get("action");
var customFields = null;
if(loc.indexOf("customfields") != -1) {
customFields = JSON.parse(urlParams.get("customfields"));
}
SP.SOD.executeOrDelayUntilScriptLoaded(retrieveListItems, "sp.js");
function retrieveListItems() {
alert("Script loaded successfully!"); // Popup-Fenster zum Testen
}
function onQueryFailed(sender, args) {
alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());
}
function closePage() {
window.close();
}
</script>
Share
Improve this question
asked 22 hours ago
MiriMiri
1
New contributor
Miri is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1 Answer
Reset to default 0You will need to utilize a rest api call to post the data you'd like to the SharePoint list. https://learn.microsoft.com/en-us/sharepoint/dev/sp-add-ins/use-the-sharepoint-javascript-apis-to-work-with-sharepoint-data
本文标签: htmlAdding Entries to SharePoint List Using JavaScriptStack Overflow
版权声明:本文标题:html - Adding Entries to SharePoint List Using JavaScript - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736582270a1944962.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论