Forum Discussion
Create a new Edit Form on List with over 5000 items in SharePoint Designer
- DeletedNov 29, 2016
This is clearly a limitation of SPD. Which MS may never update even though it is a useful tool for us limited to middle tier development due to a locked down tenant and small budgets. However, I was able to find a workaround. Basically what I did was create a new ASPX page, copy in the default Edit Form code, change all the IDs, save the file, then use REST to move the file to the list root folder.
For anyone else who encounters this issue, here is my work around.
- In SPD, create a new ASPX page in the same site where your large list is and give it a good name. You'll want to set this now to what ever name fits your needs as you'll likely need a REST call to change it later.
- Open the form that you want to duplicate in SPD > List and Libraries > YOUR LIST > Forms > Edit in Advanced Mode (right click on form). You might get some messages about the list view threshold, simply click OK and wait for the page to finish loading.
- Copy all of the code from this form. Paste the code in a text file, maybe in Notepad and save a backup.
- In SPD, browse to your new ASPX page that you created in step 1, open and make sure that you are editing in advanced mode. I saved mine to the SitePages Library.
- DO NOT SAVE after this next action. Delete all the code in your new ASPX page and paste all the code from step 3.DO NOT SAVE. You must change the IDs. By default there will be three. One on the WebPartZone and two instances of the same GUID on the ListFormWebPart.
- Look or search for "<WebPartPages:WebPartZone" and locate the "id" attribute. Change the ID. You can change this to just about anything. Typically I prefer to just change one NUMBER higher or lower. So a 5 becomes a 6 or a 4 as it is highly unlikely that SharePoint would generate an ID that would be just one number different. That is the first ID that should be changed.
- Now search or look for "__WebPartId" and you should find the ID of the ListFormWebPart. If you have more than one WebPart then you'll need to change all of those IDs accordingly. As before, I prefer to keep the same structure of the ID/GUID. So I changed just one number, up or down. That is the second ID that you'll need to change. Make note of which number you changed as you'll need to do the same change a few lines down.
- Now you'll need to find "<ID>" in the ListFormWebPart properties that has the same ID as in step 7. The ID here will likely have a prefix of "g_" and all lower case. Once you have found this value, change the same number in the same way that you did in step 7. By default, this will be the last ID that you'll need to change. If you have other WebParts on the page that you want to keep, then you'll need to change those IDs as well.
- Now save your page and do any check-in/Approve/Publish as needed for your library setup.
- Browse to the home page of the site where you want to move your new form page to. You'll likely need Full Control or Site Collection Admin to perform the next action, I'm not sure as I have both.
- Once the homepage has loaded, press F12.
- At the top of the Developer Tools, find the Console tab. Click the Console Tab.
- At the bottom right you find a double up arrow, click that to expand the code area.
- Next paste in one of the following blocks of javascript depending on whether or not you are loading jQuery.
//--------------------If your page does not load jQuery use this code, if you are already loading jQuery, use the second block
SP.SOD.registerSod("jquery-3.1.1.min.js", "https://code.jquery.com/jquery-3.1.1.min.js");
SP.SOD.executeFunc("jquery-3.1.1.min.js", "", function(){
$.ajax({
url: "ABSOLUTE-URL-TO-SITE/_api/web/getfilebyserverrelativeurl('/SERVER-RELATIVE-URL-TO-SITE/LIBRARY/NEW-FORM-PAGE.aspx')/moveto(newurl='/SERVER-RELATIVE-URL-TO-SITE/Lists/LIST-NAME/NEW-FORM-PAGE.aspx',flags=1)",
type: "POST",
contentType: "application/json;odata=verbose",
headers: {
"accept": "application/json;odata=verbose",
"X-RequestDigest": $("#__REQUESTDIGEST").val(),
"X-HTTP-Method": "POST",
"If-Match": "*"
},
success: function(){
console.log("Success");
console.log(this);
},
error: function(){
console.log("Failed");
console.log(this);
}
});
});
//--------------------Use this code if your page already loads jQuery
$.ajax({
url: "ABSOLUTE-URL-TO-SITE/_api/web/getfilebyserverrelativeurl('/SERVER-RELATIVE-URL-TO-SITE/LIBRARY/NEW-FORM-PAGE.aspx')/moveto(newurl='/SERVER-RELATIVE-URL-TO-SITE/Lists/LIST-NAME/NEW-FORM-PAGE.aspx',flags=1)",
type: "POST",
contentType: "application/json;odata=verbose",
headers: {
"accept": "application/json;odata=verbose",
"X-RequestDigest": $("#__REQUESTDIGEST").val(),
"X-HTTP-Method": "POST",
"If-Match": "*"
},
success: function(){
console.log("Success");
console.log(this);
},
error: function(){
console.log("Failed");
console.log(this);
}
}); - Change the URL paths in the code to your specific situation.
- ABSOLUTE-URL-TO-SITE
This will be the full path to your site. - /SERVER-RELATIVE-URL-TO-SITE/LIBRARY/NEW-FORM-PAGE.aspx
This will be the server relative path to the New ASPX page you created in step 1 - /SERVER-RELATIVE-URL-TO-SITE/Lists/LIST-NAME/NEW-FORM-PAGE.aspx
This is the server relative path to the list that you want to move your New ASPX to.
- ABSOLUTE-URL-TO-SITE
- With the correct URLs set in the code, look in the bottom right where the double up arrow is, you'll find a green arrow, click this to execute the code.
- To verify, go back to your list in SPD > List and Libraries > YOUR LIST > Forms. You may need to refresh to see your form.
- Now you can edit this page in the WebUI or use JSOM to implement any necessary customizations as needed.
In the long term, you need to get that count below 5000. That count includes files and folders. Move files to another NEW LIBRARY. When the count gets low enough, it will start working for you.
This is clearly a limitation of SPD. Which MS may never update even though it is a useful tool for us limited to middle tier development due to a locked down tenant and small budgets. However, I was able to find a workaround. Basically what I did was create a new ASPX page, copy in the default Edit Form code, change all the IDs, save the file, then use REST to move the file to the list root folder.
For anyone else who encounters this issue, here is my work around.
- In SPD, create a new ASPX page in the same site where your large list is and give it a good name. You'll want to set this now to what ever name fits your needs as you'll likely need a REST call to change it later.
- Open the form that you want to duplicate in SPD > List and Libraries > YOUR LIST > Forms > Edit in Advanced Mode (right click on form). You might get some messages about the list view threshold, simply click OK and wait for the page to finish loading.
- Copy all of the code from this form. Paste the code in a text file, maybe in Notepad and save a backup.
- In SPD, browse to your new ASPX page that you created in step 1, open and make sure that you are editing in advanced mode. I saved mine to the SitePages Library.
- DO NOT SAVE after this next action. Delete all the code in your new ASPX page and paste all the code from step 3.DO NOT SAVE. You must change the IDs. By default there will be three. One on the WebPartZone and two instances of the same GUID on the ListFormWebPart.
- Look or search for "<WebPartPages:WebPartZone" and locate the "id" attribute. Change the ID. You can change this to just about anything. Typically I prefer to just change one NUMBER higher or lower. So a 5 becomes a 6 or a 4 as it is highly unlikely that SharePoint would generate an ID that would be just one number different. That is the first ID that should be changed.
- Now search or look for "__WebPartId" and you should find the ID of the ListFormWebPart. If you have more than one WebPart then you'll need to change all of those IDs accordingly. As before, I prefer to keep the same structure of the ID/GUID. So I changed just one number, up or down. That is the second ID that you'll need to change. Make note of which number you changed as you'll need to do the same change a few lines down.
- Now you'll need to find "<ID>" in the ListFormWebPart properties that has the same ID as in step 7. The ID here will likely have a prefix of "g_" and all lower case. Once you have found this value, change the same number in the same way that you did in step 7. By default, this will be the last ID that you'll need to change. If you have other WebParts on the page that you want to keep, then you'll need to change those IDs as well.
- Now save your page and do any check-in/Approve/Publish as needed for your library setup.
- Browse to the home page of the site where you want to move your new form page to. You'll likely need Full Control or Site Collection Admin to perform the next action, I'm not sure as I have both.
- Once the homepage has loaded, press F12.
- At the top of the Developer Tools, find the Console tab. Click the Console Tab.
- At the bottom right you find a double up arrow, click that to expand the code area.
- Next paste in one of the following blocks of javascript depending on whether or not you are loading jQuery.
//--------------------If your page does not load jQuery use this code, if you are already loading jQuery, use the second block
SP.SOD.registerSod("jquery-3.1.1.min.js", "https://code.jquery.com/jquery-3.1.1.min.js");
SP.SOD.executeFunc("jquery-3.1.1.min.js", "", function(){
$.ajax({
url: "ABSOLUTE-URL-TO-SITE/_api/web/getfilebyserverrelativeurl('/SERVER-RELATIVE-URL-TO-SITE/LIBRARY/NEW-FORM-PAGE.aspx')/moveto(newurl='/SERVER-RELATIVE-URL-TO-SITE/Lists/LIST-NAME/NEW-FORM-PAGE.aspx',flags=1)",
type: "POST",
contentType: "application/json;odata=verbose",
headers: {
"accept": "application/json;odata=verbose",
"X-RequestDigest": $("#__REQUESTDIGEST").val(),
"X-HTTP-Method": "POST",
"If-Match": "*"
},
success: function(){
console.log("Success");
console.log(this);
},
error: function(){
console.log("Failed");
console.log(this);
}
});
});
//--------------------Use this code if your page already loads jQuery
$.ajax({
url: "ABSOLUTE-URL-TO-SITE/_api/web/getfilebyserverrelativeurl('/SERVER-RELATIVE-URL-TO-SITE/LIBRARY/NEW-FORM-PAGE.aspx')/moveto(newurl='/SERVER-RELATIVE-URL-TO-SITE/Lists/LIST-NAME/NEW-FORM-PAGE.aspx',flags=1)",
type: "POST",
contentType: "application/json;odata=verbose",
headers: {
"accept": "application/json;odata=verbose",
"X-RequestDigest": $("#__REQUESTDIGEST").val(),
"X-HTTP-Method": "POST",
"If-Match": "*"
},
success: function(){
console.log("Success");
console.log(this);
},
error: function(){
console.log("Failed");
console.log(this);
}
}); - Change the URL paths in the code to your specific situation.
- ABSOLUTE-URL-TO-SITE
This will be the full path to your site. - /SERVER-RELATIVE-URL-TO-SITE/LIBRARY/NEW-FORM-PAGE.aspx
This will be the server relative path to the New ASPX page you created in step 1 - /SERVER-RELATIVE-URL-TO-SITE/Lists/LIST-NAME/NEW-FORM-PAGE.aspx
This is the server relative path to the list that you want to move your New ASPX to.
- ABSOLUTE-URL-TO-SITE
- With the correct URLs set in the code, look in the bottom right where the double up arrow is, you'll find a green arrow, click this to execute the code.
- To verify, go back to your list in SPD > List and Libraries > YOUR LIST > Forms. You may need to refresh to see your form.
- Now you can edit this page in the WebUI or use JSOM to implement any necessary customizations as needed.