1

Is it possible to change the Display / Edit / New Form Urls, so when a user clicks on an existing list item or tries to add a new item it will redirect them to the App?

I have tried changing the Forms in the List Schema.xml but this results in build errors.

Schema.xml

<Forms>
  <Form Type="DisplayForm" Url="DispForm.aspx" SetupPath="pages\form.aspx" WebPartZoneID="Main" />
  <Form Type="EditForm" Url="EditForm.aspx" SetupPath="pages\form.aspx" WebPartZoneID="Main" />
  <Form Type="NewForm" Url="NewForm.aspx" SetupPath="pages\form.aspx" WebPartZoneID="Main" />
</Forms>

3 Answers 3

1

A possible approach for this would be to capture the click event of all the item-level operations using JavaScript, and have them redirected to your custom App.

You can use the jQuery "on" event to capture the links or ribbon actions, and execute custom code in the function handling the event. In your code then you can redirect to the App's URL and action method or form.

jQuery On: http://api.jquery.com/on/

An example showing manipulation to the New Item: http://techtrainingnotes.blogspot.com/2010/08/sharepoint-2010-change-add-new-item-and.html

A StackExchange question with something similar: Change JavaScript onclick for "add new item" link under list

1

I found the solution I was looking for:

Instead of modifying the Url's inside the Forms element you can add a FormUrls element inside the ContentType element. Here you can specify the three Url's relative to this content type

<ContentType
...
<XmlDocuments>
<XmlDocument NamespaceURI="http://schemas.microsoft.com/sharepoint/v3/contenttype/forms/url">
  <FormUrls xmlns="http://schemas.microsoft.com/sharepoint/v3/contenttype/forms/url">
    <Display>~site/Pages/Default.aspx</Display>
    <Edit>~site/Pages/Default.aspx</Edit>
    <New>~site/Pages/Default.aspx</New>
  </FormUrls>
</XmlDocument>
</XmlDocuments>
</ContentType>

Example of it in use: http://www.threewill.com/using-angular-create-dynamic-sharepoint-list-form/

Microsoft Overview: https://msdn.microsoft.com/en-us/library/office/ms473210%28v=office.14%29.aspx

0

You should have more success setting the DisplayForm, EditForm, and NewForm urls if you set them on a custom content type. When you use the OOTB forms, it will redirect the user to the appropriate form for the content type. You can set it using SharePoint designer or PowerShell.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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