none
How to create a SharePoint View through visual studio? RRS feed

  • Question

  • Hi,

    There is a SharePoint hosted add-in developed through Visual Studio 2017. All the custom lists are created through VS. I tried creating a view from a custom list as shown below in the screenshot. After deployment, the view was not displayed. Please let me know the steps involved in creating a view from VS.

    Greatly appreciate your help. Thank you in advance.

    Regards

    SLS

    Tuesday, November 12, 2019 9:12 PM

All replies

  • Hi SLS22,

    Here we create a sharepoint -host add-in and deploy it on a sharepoint online site. However the custom view displays correctly on the page.

    Hence could you please have a check the list instance? And make sure the custom view definition has been inserted into schema.xml.

    Best Regards,

    Baker Kong


    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, November 14, 2019 2:39 AM
  • Hi Baker,

    Thank you for your reply. I checked the schema.xml. Here is the custom view definition :

     </View><View BaseViewID="2" Name="4719a6ae-240d-4328-90c7-f4f2529ecd92" DisplayName="Dashboard" Type="HTML" WebPartZoneID="Main" SetupPath="pages\viewpage.aspx" Url="Dashboard.aspx" DefaultView="TRUE"><ViewFields><FieldRef Name="EditLink" /><FieldRef Name="Address" /><FieldRef Name="Score" /></ViewFields><Query /><Toolbar Type="Standard" /><XslLink Default="TRUE">main.xsl</XslLink><JSLink>clienttemplates.js</JSLink></View>

    I deployed the add-in but it did not create the view. Please help.

    Regards

    SLS

    Thursday, November 14, 2019 9:57 PM
  • Hi SLS22,

    Can you create another SharePoint host add-on and test this on another site? This may help to detect the cause of the issue.

    Thanks 

    Baker Kong


    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.

    Friday, November 15, 2019 7:40 AM
  • Hi Baker,

    Thank you for your reply. I checked and found that the view is created but I see it under ' Start from an existing view' after clicking on 'Create View'. I  was expecting to see the view directly. 

    I selected the view and it shows up along with 'All Items' view but it also shows up when I delete the view from Visual studio and deploy the SharePoint Hosted Add-in. 

    Please let me know how this view can be deleted (The view is deleted from VS and no custom view definition in schema.xml file also)

    Greatly appreciate your help.

    Regards

    SLS

    Monday, December 2, 2019 8:46 PM
  • Hi SLS22,

    To remove the view, you may manually remove the add-in and empty the recycle bin then deploy the add-in again with a new version. 

    Best Regards,

    Baker Kong


    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.

    Tuesday, December 3, 2019 5:05 AM
  • Baker,

    In that case, what about the app data? In case the data is lost, is there a way to recover?

    Please help.

    Regards

    SLS


    Tuesday, December 3, 2019 3:04 PM
  • Hi SLS22,

    You can export list data to excel :

    Best Regards,

    Baker Kong


    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, December 4, 2019 5:50 AM