zoukankan      html  css  js  c++  java
  • [转]Import List Instances and their data with Mavention Import List Instance(使用VS插件导出列表数据定义)

    When working with custom Lists you find yourself often redeploying the List and creating some test data to verify that everything is working correctly. Entering sample data may be fun to do once but becomes rather boring after a few times. Find out how to reuse your sample data in the development process using Mavention Import List Instance.

    SharePoint Lists and test data

    SharePoint Lists are a great place for storing data in SharePoint. They are very flexible, highly customizable and out of the box contain rich functionality. Not surprisingly SharePoint Lists are being used in many solutions.

    The very base of every SharePoint List is its schema: the definition of Site Columns and Content Types which can be used to store your data. Just like when working with databases, it can be challenging to modify the schema once it has been deployed, especially if the List contains some content.

    When developing custom SharePoint Lists one way to find out if everything works as planned is to fill the List with test data and run some tests. Although it might be tempting to fill in fields with random data depending on their type, it might be better to spend some more time and provide real-life information instead. This might not only help you discover some edge cases about your solution but it is also more intuitive to end users should you want to gather their feedback as well.

    The challenge with filling lists with real-life data during the development process is that there are no generators that understand your business and your scenario. So you can either create one yourself, which can get very time consuming, or fill in the data every time you modify the List schema and create a new build, which is also far from desirable. There is however yet another option…

    In the perfect world

    Wouldn’t it be great if you could enter the test data once, store them separately from your List’s schema and then reapply the data over and over again during the whole development process doing nothing more than minor changes to the data so that it fits the new schema? If that’s what you want, Mavention Import List Instance might be just the right solution for you.

    Introducting

    Mavention Import List Instance is an extension for the Visual Studio 2010 SharePoint Developer Tools that allows you to import List Instances and their data into your SharePoint Project. After importing the List Instance to your project you can include it in one of your Features and create your List prefilled with test data with a single mouse click!

    How it works

    As an example I’ve created a custom List that contains names of all Mavens. Although in this case I created the List manually, it doesn’t really matter how you would create that List as long as it’s there.

    SharePoint List with test data

    After installing Mavention Import List Instance a new menu item is added to every List node in the Server Explorer.

    Import List Instance menu item added to the List context menu

    After clicking the menu item, the extension will import the selected List to your SharePoint Project as a List Instance SharePoint Project Item (SPI).

    Important: for the Import operation to work, you have to have a SharePoint Project open and active in Visual Studio.

    List imported to a SharePoint Project

    As you can see, the Mavention Import List Instance extension includes all field values in the imported List Instance SPI. To keep your test data clean and manageable it might be a good idea to remove all the unnecessary fields such as CreatedAuthor, etc. Values of most of those fields cannot be imported anyway and are generated automatically by SharePoint.

    Tip: Removing unnecessary fields can be doable if you have only a few rows but can quickly become a tedious process. In my next article I will show you how you can remove unwanted fields from the exported List Instance using XSLT and Visual Studio.

    The only thing left for you to do now is to add the imported List Instance SPI to a Feature and the next time you will deploy your Solution and activate that Feature your List will be filled with some sample data.

    A newly created list including its data in a Team Site

    The great part is that this approach works with new lists as well as existing lists.

    Download: Mavention Import List Instance from Visual Studio Gallery.

  • 相关阅读:
    索引覆盖与覆盖索引的深入探究
    附加数据库后,数据库状态为只读
    Starting MySQL. ERROR! The server quit without updating PID file(xxx/x.pid)
    【1.4】shell基本实践——根据文件做交互选择
    mysql中count与null的坑
    深入理解yield(二):yield与协程
    深入理解yield(三):yield与基于Tornado的异步回调
    tornado.gen 模块解析
    pip 安装指定版本的python包
    [转]Tornado get/post请求异步处理框架分析
  • 原文地址:https://www.cnblogs.com/kxlf/p/2234413.html
Copyright © 2011-2022 走看看