none
Alternative to ContentTypeID to open a Newform.aspx from a list with multiple content types

All replies

  • Hi

    How about use a relative URL in the Source param.


    Justin Liu Office Apps & Services MVP, MCSE
    Senior Software Engineer
    Please Vote and Mark as Answer if it helps you.

    Wednesday, February 13, 2019 2:39 AM
  • Hi,

    If want to open new form with a specific Content Type, it is necessary to append with ContentTypeID, so this part can not be shorter.

    A workaround is to use the relative url for Source parameter, if it is a page in the Site Pages library, set the url like this:

    http://sp/sites/dev/Lists/Todays/NewForm.aspx?Source=/sites/dev/SitePages/AddUsers.aspx&ContentTypeId=0x01002B80BB5A4A41F248AB06C614D45D356A

    Checked the length in NotePad++, it shows 144 character length which should be less than the max limit.

    Thanks

    Best Regards


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    SharePoint Server 2019 has been released, you can click here to download it.
    Click here to learn new features. Visit the dedicated forum to share, explore and talk to experts about SharePoint Server 2019.

    Wednesday, February 13, 2019 8:54 AM
  • Hello,

    I tried it and it did not work.  The URL was short enough, but it appears that with the Source= in the URL, it only opens the default content type.  So I have five content types and with the Source = in each of them, the newform.aspx only opened the first (default) form.  Ugh.

    Any ideas?


    Thanks! Patti N.

    Wednesday, February 13, 2019 9:04 PM
  • Hi,

    Tested to create a new custom list and add some Content Types:

    And find out the Content Type Id from list settings url:

    Then build the url like this:

    http://sp/sites/dev/Lists/MyList0/NewForm.aspx?ContentTypeID=0x010600D953E249F60F854DB20A44AEC7B8FD61&Source=/sites/dev/SitePages/testpage.aspx

    This url will open the Contacts Content Type new form as expected:

    Thanks

    Best Regards


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    SharePoint Server 2019 has been released, you can click here to download it.
    Click here to learn new features. Visit the dedicated forum to share, explore and talk to experts about SharePoint Server 2019.

    Thursday, February 14, 2019 4:32 AM
  • Thank you.  I will test this again today to see if I can get it to work.

    Thanks! Patti N.

    Friday, February 15, 2019 2:59 PM
  • Hi,

    Sure. Will wait for updates.

    Thanks

    Best Regards


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    SharePoint Server 2019 has been released, you can click here to download it.
    Click here to learn new features. Visit the dedicated forum to share, explore and talk to experts about SharePoint Server 2019.

    Monday, February 18, 2019 2:40 AM
  • For some reason, I cannot get the relative url to work. Rather than using the long ContentTypeID, is it possible to use ContentTypeName (which is much shorter than the ID)? If yes, does it have to be in quotes or anything like that?

    example:ContentTypeName="Fred"?Source=https...


    Thanks! Patti N.

    Tuesday, February 19, 2019 7:18 PM
  • Hi,

    It is necessary to append Content Type Id in the url, Content Type name is not possible to open the new form with specific content type.

    As I see even Source parameter have complete url rather than relative one, it will only have site collection url, it also should not exceed 255 characters, I checked in NotePad++ for example:

    http://sp/sites/dev/Lists/Todays/NewForm.aspx?Source=http://sp/sites/dev/SitePages/AddUsers.aspx&ContentTypeId=0x01002B80BB5A4A41F248AB06C614D45D356A

    Only 149 characters length.

    Reference:

    Linking Directly To The New Form For Multiple Content Types

    Thanks

    Best Regards


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    SharePoint Server 2019 has been released, you can click here to download it.
    Click here to learn new features. Visit the dedicated forum to share, explore and talk to experts about SharePoint Server 2019.



    Wednesday, February 20, 2019 1:00 PM