Feature Event Receiver activation, application page set as default newform
-
01-10-2020 - |
Domanda
I am trying to set the application page as default.
So I have added an application page in layouts
folder using visual studio.
But when I run the code in feature activation I am trying to get the file in layouts folder
Spfile form = web.GetFile("_layouts/filename");
But if I check if(form.exists)
It fails the condition.
Soluzione
Once the feature is activated we access the default content type in the “Demo List” list which is “Item” , we save it’s default forms urls as custom web properties so we can recover them when we need to do so. Then we access once again the “Item” content type to define its forms url’s using the customs forms urls this time. For more Details check URL" https://achrafsp.wordpress.com/tag/programmatically-provisioning-list-custom-forms/
You can also find code for this in above article.
Also if you are creating list using Visual Studio then in List defination also you can specify custom application pages present in layout folder. You can also check for this in above url.
Altri suggerimenti
For accessing layout folder (which is in the file system) you should use a different approach.
For 2013
For 2010 SPUtility.GetGenericSetupPath