0

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.

1

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.

  • Awesome.. Worked perfectly for me.. – Avinash Jan 7 '15 at 20:35
  • @Avinash: Glad to hear that..:) – Amit Jan 8 '15 at 4:02
0

For accessing layout folder (which is in the file system) you should use a different approach.

For 2013

http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.utilities.sputility.getversionedgenericsetuppath.aspx

For 2010 SPUtility.GetGenericSetupPath

  • Can you provide some code – Avinash Jan 6 '15 at 20:08
  • Its giving me an error while deploying.. – Avinash Jan 6 '15 at 20:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.