[Forum FAQ] A custom filterable list definition

Scenario:
A list can be filtered by query string from URL, now we need to create a custom list definition contains this feature.
Solution:
Here are the steps in details:
1. Create a List Definition project in Visual Studio 2010;
2. Modify the Schema.xml file in the list definition project as below:
3. Build and deploy the solution to SharePoint 2010 server;
4. Here are the screenshots about how it works:
Filter the list with such an URL:
http://sp/Lists/List1/AllItems.aspx?Param1=2014-08-24&Param2=2014-08-28
References:
Creating SharePoint 2010 List Definitions in Visual Studio 2010
SharePoint 2010 - Create List Definition and Instance
Please click to vote if the post helps you. This can be beneficial to other community members reading the thread.

A good solution. Liked it very much. Can you please make it a technet blog for others.
[email protected]

Similar Messages

  • Can I add Custom Content Type created programmatically to Custom List Definition?

    I have created Custom content type programmatically in the Feature Receiver. Followed by this have another feature which creates List Template. I want to add the custom content type to the list template.
    Using VS 2012, I added the custom content type to the list definition. The Schema.xml for the list definition looks as below:
    <ContentTypes>
    <ContentTypeRef ID="0x010100D7D9F4B1F4A9684BB44389571024B2EC00C393BB21B8AD7B41B62A87DF0501504D" />
    </ContentTypes>
    ID was automatically added by the VS tool.
    List Template is created, the new content Type is also added, but the Name is displayed as "Document" instead of the custom content type name. So I see two CTs with the name "Document".
    How can I achieve this? Any help is appreciated.

    Hi,
    Please add EnableContentTypes="TRUE" in the <List > tag.
    The following materials would be helpful:
    How to add custom content type to a custom list
    http://innersharepoint.blogspot.de/2009/10/how-to-add-custom-content-type-to.html
    SharePoint Custom List Definition with Content Type
    https://achrafsp.wordpress.com/2013/03/31/sharepoint-list-definition-with-content-type/
    Create a Custom SharePoint List Definition
    http://www.mssharepointtips.com/tip.asp?id=1188
    Best Regards
    Dennis Guo
    TechNet Community Support

  • [Forum FAQ] A content management tool with dashboard based on SharePoint List

    1. 
    Scenario:
    The SharePoint OOTB List has saved us a lot of time on managing mess data. It provides three forms to create/view/edit items, the ability to save the views we want with some specific filtering and sorting condition, versioning for easy restoring, and we
    can make it advanced with workflow contains the specific business logic.
    However, if there is a need for better user experience, interacting with the public APIs and a bit of script to customize the web page would be required.
    Suppose there is a requirement like this:
    We need a content collection tool which collects ideas from contributors, the newly ideas will be reviewed by reviewers.
    We may need to filter the list in a convenient way, get the wanted result with the data from the list and display in a chart or rank list. 
    We can add some buttons in Metro style to display the counting result of the data from the list dynamically. When we click them, the list will be filtered and sorted to display a friendly set of items. Also, we need to display a trend of the mess data graphically
    in some beautiful charts.  If we want to find out some outstanding contributors, top contributor board would be more comfortable than the top N items in the OOTB list view.
    The page would look like this:
    2. 
    Introduction:
    Engineers will come up with some ideas in the daily job and write a content to enlighten others. Reviewers will help to review ideas or contents and publish the contents if qualified.
    The complete process looks like this:
    As we can see, only the approved idea can be written as a content and only the approved content can be published.
    2.1
    How it works
    We build the whole tool in one page. All ideas and contents will be saved in a custom list. This is how it looks like:
    There are three parts in this page:
    1       
    2       
    2.1       
    2.1.1       
    Top menu
    The top menu contains three elements:
    A Drop Down menu for filtering data by team, it will refresh the other two parts with the filtered data:
    A hyperlink “STATISTIC” links to a PowerBI report whose data source is the custom list.
    A hyperlink “FEEDBACK” for collecting feedbacks:
    The feedbacks will be saved in another list:
    2.1.2       
    Information menu
    This part will display the calculated data retrieved from the list within tiles, chart and ranking list.
    The tiles can be clicked to filter and refresh the list view.
    2.1.3       
    List view
    A list stores all ideas and contents with the properties needed. It can be filtered by the Top menu and Information menu.
    The customization on the OOTB custom list template makes it more powerful and more suit for this scenario:
    1. An item leveled comment feature (based on OOTB Tags & Notes feature) for other users make comments to an idea or content:
    2. Title column: When there is no attachment in the current item, it redirects to the default DisplayForm page. If there is, it will open the attachment (usually a .docx file) in Word Online in a new tab.
    3. ECB menu: Add some custom shortcuts for popular actions:
    4. A hyperlink column stores the hyperlink points to the website where the content is published to.
    3.   
    How to achieve it
    This solution will be hosted in SharePoint Online environment, so we do all the job using JavaScript, REST API and Client Object Model.
    The Drop Down menu, tiles, rank list are generated with some HTML+CSS.
    The Trend Chart, we take advantage of the Combo chart in the Google chart library.  
    The list view is hosted in a <iframe> which can be easily filtered and refreshed by just passing a generated URL with query string.
    For the customization on the list view and the ECB menu, JSLink with Client Object Model would be OK.
    3.1
    Specific to every part
    3.1.1       
    Top menu
    3.1.1.1 
    Drop Down menu for retrieving filtered data and refreshing the display of the related controls
    When user selects a team here, there will be a request sent out for retrieving items of the list. By default, the limit is 100 when using REST API to get list items, so we can append a “$top=1000” to require more items from server.
    Code snippet like this:
    $.ajax({
    url: _spPageContextInfo.webAbsoluteUrl + "/_api/web/lists/getbytitle('" + listName + "')/items?$top=1000",
    method: "GET",
    headers: { "Accept": "application/json; odata=verbose" },
    success: function (data) {
    console.log("getListItems succ");
    console.log(data);
    error: function (data) {
    alert("getListItems error");
    //failure(data);
    Then we will get the “data” as a JSON format string, it contains all the values we need from the list:
    We can get the values we want like this:
    //get item Count
    var arr = [], len;
    for(key in data.d.results)
    arr.push(key);
    len = arr.length;
    for(var ii=0; ii<len; ii++)
    var team = data.d.results[ii].Team;
    var month = data.d.results[ii].Month;
    As we need to know the counts of each type of ideas or contents, we use an array for saving the counters:
    //ary to store all counters for tiles: all/pendingIdea/pendingContent/my/approvedIdea/approvedContent
    var aryAllCounters = [0,0,0,0,0,0];
    for(var ii=0; ii<len; ii++)
    //get pendingIdeaCount
    if(data.d.results[ii].Statuss === 'Pending')
    aryAllCounters[1]++;
    Once all the numbers are ready, we can do the refreshing.
    As the list view page is hosted in a <iframe>, all we need to do is passing a constructed URL with query string:
    url_team = URL + "?FilterField1="+FIELD_MYTEAM+"&FilterValue1=" + sel_val;
    $iframe.attr('src', url_team);
    3.1.1.2 
    Hyperlink for popping up a dialog to collect feedbacks
    The feedback dialog hosts another page which contains two buttons and one text area.
    The HTML code of the FEEDBACK button:
    <a id="feedback" href="#" onclick="javascript:openDialogBox('../SitePages/Feedback.aspx');">FEEDBACK</a>
    The openDialogBox() function:
    function openDialogBox(url){
    var options = SP.UI.$create_DialogOptions();
    options.url = url;
    options.height = 130;
    options.width = 425;
    options.title = "Feedback";
    SP.UI.ModalDialog.showModalDialog(options);
    In the Feedback.aspx page, when user click submit button, we will save the content of the text area into the feedback list:
    function addListItem()
    this.clientContext = new SP.ClientContext.get_current();
    this.oList = clientContext.get_web().get_lists().getByTitle('Feedback');
    var itemCreateInfo = new SP.ListItemCreationInformation();
    this.oListItem = this.oList.addItem(itemCreateInfo);
    //set person field
    var userValue = new SP.FieldUserValue();
    //userValue.set_lookupId(this.currentUser.get_id());
    userValue.set_lookupId(_spPageContextInfo.userId);
    oListItem.set_item('Provider', userValue);
    //Sets the specified field value
    oListItem.set_item('Title', str);
    //datetime field
    var currDate = new Date();
    oListItem.set_item('Submit_Time',currDate);
    oListItem.update();
    clientContext.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded_add), Function.createDelegate(this, this.onQueryFailed));
    3.1.2       
    Information menu
    3.1.2.1 
    Tile shortcut
    In the click event of the tiles, the code will pass a generated URL with query string to the <iframe>:
    //filter list only
    $tile.click(function(){
    //distinguish tiles by id
    var v = $(this).attr('id');
    switch(v)
    case S_MY_CONTENT:
    url_team1 = URL + "?FilterField1="+FIELD_COMPOSER+"&FilterValue1=" + currentUsername;
    break;
    case S_PENDING_IDEA:
    url_team1 = url_team + "&FilterField2="+FIELD_STATUS+"&FilterValue2=Pending&FilterField3="+FIELD_IDEATYPE+"&FilterValue3=Idea";
    break;
    $iframe.attr('src', url_team1);
    3.1.2.2 
    Trend chart
    The chart will be initialized with the numbers by month stored in a 3D array:
    google.load("visualization", "1", {packages:["corechart"]});
    google.setOnLoadCallback(drawVisualization);
    function drawVisualization(ary)
    // Some raw data (not necessarily accurate)
    var data = google.visualization.arrayToDataTable(ary);
    var view = new google.visualization.DataView(data);
    view.setColumns([0, 1,
    { calc: "stringify",
    sourceColumn: 1,
    type: "string",
    role: "annotation"
    2]);
    // Create and draw the visualization.
    var ac = new google.visualization.ComboChart(document.getElementById('chart1'));
    ac.draw(view, {
    //legend: 'top',
    legend: {
    title : '',
    //width: 0,
    //height: 285,
    vAxis: {title: "", format:'#',viewWindowMode:'explicit',
    viewWindow:{
    min:0
    },ticks: ticks
    //hAxis: {title: ""},
    lineWidth: 4,
    bar: {groupWidth: "60%"},
    seriesType: "bars",
    series: {1: {type: "line"}},
    chartArea:{
    colors: ['#A4C400', '#F9A13B']
    3.1.2.3 
    Top contributors rank list
    When retrieving list items, we can get the “AuthorId” which represents the id of the user in the siteUserInfoList. We run another request to retrieve all items in the siteUserInfoList which stores the username with the URL of profile.
    Then we can use a hash table(provided by jshashtable.js) to store the user id, username and profile URL:
    $.ajax({
    url: _spPageContextInfo.webAbsoluteUrl + "/_api/web/siteUserInfoList/Items",
    method: "GET",
    headers: { "Accept": "application/json; odata=verbose" },
    success: function (data) {
    console.log(data);
    //get item Count
    var arr = [], len;
    for(key in data.d.results)
    arr.push(key);
    len = arr.length;
    var ht_authors = new Hashtable();
    for(var ii=0; ii<len; ii++)
    if(authorSet.contains(data.d.results[ii].Id))
    if(data.d.results[ii].Picture != null)
    ht_authors.put(data.d.results[ii].Id, data.d.results[ii].Title+'|'+data.d.results[ii].Picture.Url);
    else
    ht_authors.put(data.d.results[ii].Id, data.d.results[ii].Title+'|');
    console.log("ht_authors.keys(): "+ht_authors.keys());
    console.log("ht_authors.values(): "+ht_authors.values());
    error: function (data) {
    alert("error");
    //failure(data);
    3.1.3       
    List view
    For the Comment button, custom title link and the custom published link of each item, we can use JSLink to achieve.
    Comment button: It is supposed to be the OOTB “Type” column, I change the icon and modify the click event of it to pop up a comment dialog which take advantage of the OOTB “Tags&Notes” feature;
    Custom Title link: As there will be two situations of an item: has attachment or not. We will need to run a request to get the URL of attachment and change the hyperlink of the Title field accordingly:
    (function () {
    // Create object that have the context information about the field that we want to change it output render
    var linkFiledContext = {};
    linkFiledContext.Templates = {};
    linkFiledContext.Templates.Fields = {
    //"Attachments": { "View": AttachmentsFiledTemplate }
    "LinkTitle": { "View": TitleFieldTemplate },
    "Published_x0020_Link": { "View": PublishedLinkFieldTemplate },
    "DocIcon": { "View": DocIconFieldTemplate },
    "MyTeam": { "View": MyTeamFieldTemplate }
    SPClientTemplates.TemplateManager.RegisterTemplateOverrides(linkFiledContext);
    function DocIconFieldTemplate(ctx)
    var htmlStr = "";
    var listId = ctx.listName;
    var itemId = ctx.CurrentItem.ID;
    var s = listId + "," + itemId;
    htmlStr += "<img width='16' height='16' class=' ms-draggable' alt='Comment' src='"+_spPageContextInfo.webAbsoluteUrl+"/Shared%20Documents/img/comment-icon.png' border='0' ms-draggableragId='0' onclick='CommentIcon(\""+ s +"\")'></img>";
    return htmlStr;
    function CommentIcon(s)
    var listId = s.split(',')[0];
    var itemId = s.split(',')[1];
    var url=_spPageContextInfo.webAbsoluteUrl+"/_layouts/15/socialdataframe.aspx?listid="+listId+"&id="+itemId+"&mode=1";
    console.log(url);
    openCustomDialog(url,"Comment",650,520);
    function openCustomDialog(pageUrl,title,width,height)
    SP.UI.ModalDialog.showModalDialog({
    url: pageUrl,
    width: width,
    height: height,
    title: title,
    dialogReturnValueCallback: function (result){
    if(result== SP.UI.DialogResult.OK)
    parent.window.location.href=parent.window.location.href;
    function PublishedLinkFieldTemplate(ctx)
    //console.log(ctx);
    var htmlStr = "";
    var itemPublishedLink = "";
    var itemPublishedLinkDesc = "";
    if((ctx.CurrentItem.Published_x0020_Link != ''))
    itemPublishedLink = ctx.CurrentItem.Published_x0020_Link;
    itemPublishedLinkDesc = ctx.CurrentItem["Published_x0020_Link.desc"];
    htmlStr = "<a href='" + itemPublishedLink + "' target='_blank'>" + itemPublishedLinkDesc + "</a>";
    return htmlStr;
    function MyTeamFieldTemplate(ctx)
    var htmlStr = "";
    var itemMyTeam = "";
    if((ctx.CurrentItem.MyTeam[0] != undefined) && (ctx.CurrentItem.MyTeam[0] != null))
    itemMyTeam = ctx.CurrentItem.MyTeam[0].lookupValue;
    htmlStr = itemMyTeam;
    return htmlStr;
    function TitleFieldTemplate(ctx) {
    console.log(ctx.CurrentItem);
    var itemId = ctx.CurrentItem.ID;
    var itemTitle = ctx.CurrentItem.Title;
    var listName = ctx.ListTitle;
    var siteUrl = _spPageContextInfo.webAbsoluteUrl;
    var listUrl = _spPageContextInfo.webAbsoluteUrl + "/Lists/" +listName;
    var fileNames = getAttachmentsNames(listName, itemId);
    console.log(fileNames);
    var fileNameAry = fileNames.split("|");
    var htmlStr = "";
    //check the attachment existence
    if(fileNameAry[0] != '')
    for(var j = 0; j < fileNameAry.length; j++)
    var fileName = fileNameAry[j];
    var s1 = "<a class=\"ms-listlink ms-draggable\" onmousedown=\"return VerifyHref(this, event, '1', 'SharePoint.OpenDocuments.3', '1";
    //1``https://microsoft.sharepoint.com/teams/spfrmcs
    var s2 = "/_layouts/15/WopiFrame.aspx?sourcedoc=";
    //2``/teams/spfrmcs/Lists/Content%20Pool
    var s3 = "/Attachments/";
    //3``137
    var s4 = "/";
    //4``[Forum FAQ] Highlight the list tab in Quick Launch when the list view changes.docx
    var s5 = "&action=default'); return false;\" href=\"";
    //5``https://microsoft.sharepoint.com/teams/spfrmcs/Lists/Content Pool
    var s6 = "/Attachments/";
    //6``137
    var s7 = "/";
    //7``[Forum FAQ] Highlight the list tab in Quick Launch when the list view changes.docx
    var s8 = "\" target=\"_blank\" DragId=\"1\">";
    //8``Highlight the list tab in Quick Launch when the list view changes
    var s9 = "</a>";
    var s = s1+siteUrl+s2+listUrl+s3+itemId+s4+fileName+s5+listUrl+s6+itemId+s7+fileName+s8+itemTitle+s9;
    htmlStr += s;
    //console.log(htmlStr);
    if (j != fileNameAry.length - 1)
    htmlStr += "<br/>";
    //if no attachments, set the <a> point to displayForm
    else
    htmlStr += "<a class='ms-listlink ms-draggable' onclick='EditLink2(this,28);return false;' onfocus='OnLink(this)' href='" + siteUrl + "/_layouts/15/listform.aspx?PageType=4&ListId=%7BE54A4FBB%2DDDC2%2D4F7E%2D8343%2D8A1C78757CF4%7D&ID=" + itemId + "&ContentTypeID=0x010079A1D928FF77984C80BFEF1D65C3809F' target='_blank' DragId='0'>" + itemTitle + "</a>";
    return htmlStr;
    function getAttachmentsNames(listName,itemId) {
    var url = _spPageContextInfo.webAbsoluteUrl;
    var requestUri = url + "/_api/web/lists/getbytitle('" + listName + "')/items(" + itemId + ")/AttachmentFiles";
    var str = "";
    // execute AJAX request
    $.ajax({
    url: requestUri,
    type: "GET",
    headers: { "ACCEPT": "application/json;odata=verbose" },
    async: false,
    success: function (data) {
    for (var i = 0; i < data.d.results.length; i++)
    if(i != 0)
    str += "|";
    str += data.d.results[i].FileName;
    error: function (err) {
    //alert(err);
    return str;
    3.2
    How to make them work together
    When selecting an option in the Drop Down menu, the Information menu and the List view will be refreshed separately.
    When clicking the tiles, only the list view will be filtered and refreshed, the other parts will not be influenced.
    When items created/modified, the whole page will be refreshed to keep all the numbers in each part updated.  A workflow will also be triggered to inform engineers or reviewers the progress of an item or content.
    3.3
    Other customizations
    3.3.1       
    ECB menu and permission control
    As we need to refresh the page when new item or modify item, we put all the form pages in a custom modal dialog and execute the refresh in the success callback function.
    There are three roles: Site owner, reviewer and engineer. They have limited privileges according to the roles they are:
    Site owner: Full control on the list, can see all the buttons in the ECB menu;
    Reviewer: There is another list which stores the names of each team and reviewers’ names of each team. The reviewer has limited full control only on the team they belong to. To other teams, the role can be seen as a visitor;
    Composer
    (create owner): The one who contribute an idea. For the ideas\contents from other teams, this role can be seen as visitor.
    The ECB menu they can see is:
    For the visitor, the ECB menu will only display a few buttons:
    The code:
    (function () {
    var viewContext = {};
    viewContext.Templates = {};
    viewContext.OnPostRender = OnViewPostRender;
    SPClientTemplates.TemplateManager.RegisterTemplateOverrides(viewContext);
    function OnViewPostRender(ctx) {
    $("a[title='More options']").removeAttr("onclick");
    $(".ms-list-itemLink").removeAttr("onclick");
    $("a[title='More options']").attr("onclick", "showMenuList(this);return false;");
    function showMenuList(obj) {
    var itemId = $(obj).parents("tr").attr("id").split(",")[1];
    //show ECB menu
    CoreInvoke('ShowECBMenuForTr', obj, event);
    var teamId = getCurrentTeamId("Content Pool", itemId);
    var styles = "";
    if (isSiteOwner("Technet SharePoint Team Owners")) {
    styles = "li[text='Delete Item ']{display:block;} li.ms-core-menu-separator:last-child{display:block;} ul.ms-core-menu-list > li:nth-last-child(5){display:block;} li[text='Edit Item ']{display:block;} li[text='Upload Document']{display:block;} li[text='Approve']{display:block;} li[text='Reject']{display:block;} li[text='Add Publish Link']{display:block;}";
    } else if (isReviewer("List1_FAQ_team", teamId, "Reviewers")) {
    styles = "li[text='Delete Item ']{display:block;} li.ms-core-menu-separator:last-child{display:block;} ul.ms-core-menu-list > li:nth-last-child(5){display:block;} li[text='Edit Item ']{display:block;} li[text='Upload Document']{display:block;} li[text='Approve']{display:block;} li[text='Reject']{display:block;} li[text='Add Publish Link']{display:block;}";
    } else if (isComposer(obj)) {
    styles = "li[text='Delete Item ']{display:block;} li.ms-core-menu-separator:last-child{display:block;} ul.ms-core-menu-list > li:nth-last-child(5){display:block;} li[text='Edit Item ']{display:block;} li[text='Upload Document']{display:block;} li[text='Approve']{display:none;} li[text='Reject']{display:none;} li[text='Add Publish Link']{display:none;}";
    } else {
    styles = "li[text='Delete Item ']{display:none;} li.ms-core-menu-separator:last-child{display:none;} ul.ms-core-menu-list > li:nth-last-child(5){display:none;} li[text='Edit Item ']{display:none;} li[text='Upload Document']{display:none;} li[text='Approve']{display:none;} li[text='Reject']{display:none;} li[text='Add Publish Link']{display:none;}";
    includeStyleElement(styles);
    //get current team id
    function getCurrentTeamId(listName,itemId){
    var teamId="";
    var requestUri = _spPageContextInfo.webAbsoluteUrl +
    "/_api/Web/Lists/getByTitle('"+listName+"')/items("+itemId+")?$select=MyTeamId";
    // execute AJAX request
    $.ajax({
    url: requestUri,
    type: "GET",
    headers: { "ACCEPT": "application/json;odata=verbose" },
    async: false,
    success: function (data) {
    if(data.d.MyTeamId!=null){
    teamId=data.d.MyTeamId;
    }else{
    teamId="0";
    error: function () {
    //alert("Failed to get details");
    return teamId;
    //check whether is owner
    //Technet SharePoint Team Owners
    function isSiteOwner(groupName) {
    var flag = false;
    var requestUri = _spPageContextInfo.webAbsoluteUrl + "/_api/Web/effectiveBasePermissions";
    // execute AJAX request
    $.ajax({
    url: requestUri,
    type: "GET",
    headers: { "ACCEPT": "application/json;odata=verbose" },
    async: false,
    success: function (data) {
    var permissions = new SP.BasePermissions();
    permissions.fromJson(data.d.EffectiveBasePermissions);
    flag = permissions.has(SP.PermissionKind.managePermissions);
    error: function () {
    //alert("Failed to get details");
    return flag;
    function isComposer(obj) {
    var flag = false;
    var userId = _spPageContextInfo.userId;
    var composerId = $(obj).parents("tr").find("a[href*='userdisp.aspx']").attr("href").split("ID=")[1];
    if (composerId == userId) {
    flag = true;
    return flag;
    //check whether is reviewer
    function isReviewer(listName,teamId,peopleColumn){
    var flag=false;
    var userId=_spPageContextInfo.userId;
    // begin work to call across network
    var requestUri = _spPageContextInfo.webAbsoluteUrl +
    "/_api/Web/Lists/getByTitle('"+listName+"')/items?$select=ID&$filter=(ID eq '"+teamId+"' and "+peopleColumn+"Id eq '"+userId+"')";
    // execute AJAX request
    $.ajax({
    url: requestUri,
    type: "GET",
    headers: { "ACCEPT": "application/json;odata=verbose" },
    async: false,
    success: function (data) {
    if(data.d.results.length>0){
    flag=true;
    error: function () {
    //alert("Failed to get details");
    return flag;
    //insert style into page
    function includeStyleElement(styles) {
    var style = document.createElement("style");
    style.type = "text/css";
    (document.getElementsByTagName("head")[0] || document.body).appendChild(style);
    if (style.styleSheet) {
    //for ie
    style.styleSheet.cssText = styles;
    } else {
    //for w3c
    style.appendChild(document.createTextNode(styles));
    3.3.2       
    Workflow email customization
    The email will only be sent to engineer or team reviewer in the three scenarios:
    When engineer uploads an idea or content, reviewer will receive an email;
    When engineer uploads a content to an existing idea, reviewer will receive an email;
    When reviewer approve/reject an idea or content, engineer will receive an email;
    The design of the workflow process  :
     The email design like this:
    Email to engineer
    Email to reviewer
    Let us know if you are interested in it. Happy coding!
    Please click to vote if the post helps you. This can be beneficial to other community members reading the thread.

    A good solution. Liked it very much. Can you please make it a technet blog for others.
    [email protected]

  • Adding custom button to Ribbon for custom list definition

    I'm trying to add a custom button to the ribbon, specifically for a custom list definition.  I have two custom list definitions, one for a document library (Type="11008") and one for a list (Type="10002").  
    I can use the following CustomAction to successfully add a button to the document library ribbon:
    <CustomAction Id="MyCustomAction.DocLib"
    RegistrationId="11008"
    RegistrationType="List"
    Location="CommandUI.Ribbon">
    <CommandUIExtension>
    <CommandUIDefinitions>
    <CommandUIDefinition Location="Ribbon.Library.Share.Controls._children">
    <Button
    Id="MyCustomAction.DocLib.Button"
    Alt="Help"
    Sequence="5"
    Command="SayHi"
    Image32by32Left="-64" Image32by32Top="-320" Image32by32="/_layouts/$Resources:core,Language;/images/formatmap32x32.png"
    Image16by16Left="-64" Image16by16Top="-176" Image16by16="/_layouts/$Resources:core,Language;/images/formatmap16x16.png"
    LabelText="Say Hi!"
    TemplateAlias="o1"/>
    </CommandUIDefinition>
    </CommandUIDefinitions>
    <CommandUIHandlers>
    <CommandUIHandler Command="SayHi" CommandAction="javascript:alert('Hi!');"/>
    </CommandUIHandlers>
    </CommandUIExtension>
    </CustomAction>
    If I try to do the same thing for my list, the button does not show up:
    <CustomAction Id="MyCustomAction.List"
    RegistrationId="10002"
    RegistrationType="List"
    Location="CommandUI.Ribbon">
    <CommandUIExtension>
    <CommandUIDefinitions>
    <CommandUIDefinition Location="Ribbon.List.Share.Controls._children">
    <Button
    Id="MyCustomAction.List.Button"
    Alt="Help"
    Sequence="5"
    Command="SayHi"
    Image32by32Left="-64" Image32by32Top="-320" Image32by32="/_layouts/$Resources:core,Language;/images/formatmap32x32.png"
    Image16by16Left="-64" Image16by16Top="-176" Image16by16="/_layouts/$Resources:core,Language;/images/formatmap16x16.png"
    LabelText="Say Hi!"
    TemplateAlias="o1"/>
    </CommandUIDefinition>
    </CommandUIDefinitions>
    <CommandUIHandlers>
    <CommandUIHandler Command="SayHi" CommandAction="javascript:alert('Hi!');"/>
    </CommandUIHandlers>
    </CommandUIExtension>
    </CustomAction>
    What am I missing that is keeping me from getting this button to show up in my List ribbon?

    Well, I debated just deleting my question, but I'll leave it up in case someone else runs into this.  My custom list definition for my list had <Toolbar Type="Freeform" />.  I don't remember why I changed that, but once I changed
    that back to <Toolbar Type="Standard"/> my custom buttons started showing up as expected.
    The answer
    here pointed me in the right direction.

  • Hide a field inherited by the content type in a custom list definition

    The requirement is to create new content type that inherits from a Parent content type. I also created custom document library definition that uses the newly created content type.
    There are some fields that are inherited from the parent type that I would like "NOT TO" show in the edit/display form in the libraries created based on the new list definition.
    How can I achieve this? In the list definition, I added ShowInEditForm="FALSE" and ShowInDisplayForm="FALSE" ShowInViewForm="FALSE".
    But these fields won't hide and it still shows up when a new document is uploaded. Any help would be appreciated.
    Thanks!

    Hey,
    Have
    this link for your reference. It will help you.
    Thanks. Please mark it as an answer if it helps.

  • Custom Asset library List Definition

    Hi All,
    I am trying to create a list definition for asset library using visual studio 2010. Now the problem is there is no such template for Asset library available in visual studio, so can anyone please tell me the workaround for that??

    Hi,
    You can create the list definition based on the AssetLibrary by copy/paste the “AssetLibrary” folder under features directly.
    Here is a similar thread for your reference:
    https://social.msdn.microsoft.com/forums/sharepoint/en-US/1e25f974-9f20-4a67-8c68-ee3f33584bc2/list-definition-in-asset-library-sharepoint-2013
    Best Regards
    Dennis Guo
    TechNet Community Support

  • Custom List definition site columns managed properties not appearing in search results

    Hi i developed a site column, custom content type and a list definition. I set the value for this column and started crawling but i don't find these properties in search schema. If i add this column manually in a library and start crawling, these properties
    are showed. What 's the difference?
    kesari suresh

    HI,
    I am able to finally crack the issue.
    I forgot to add the Event Receiver for the new List Definition I was creating.
    Added below lines in the Event receiver of List definition and found that the crawled properties and Managed properties (For Managed Metadata Columns) were creating successfully.
    <Receiver>
          <Name>TaxonomyItemSynchronousAddedEventReceiver</Name>
          <Type>ItemAdding</Type>
          <Assembly>Microsoft.SharePoint.Taxonomy,
    Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c</Assembly>
          <Class>Microsoft.SharePoint.Taxonomy.TaxonomyItemEventReceiver</Class>
          <SequenceNumber>10000</SequenceNumber>
        </Receiver>
        <Receiver>
          <Name>TaxonomyItemUpdatingEventReceiver</Name>
          <Type>ItemUpdating</Type>
          <Assembly>Microsoft.SharePoint.Taxonomy,
    Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c</Assembly>
          <Class>Microsoft.SharePoint.Taxonomy.TaxonomyItemEventReceiver</Class>
          <SequenceNumber>10000</SequenceNumber>
        </Receiver>
    Thanks,
    kesari suresh

  • List definition custom type ID or SharePoint base type ID ?

    I have successfully created list definitions using a custom type value in the elements.xml as well as by leaving the type value at the Visual Studio default of 101 (for a custom document library).
    Leaving the type value as 101 seems to work as long as the definition is in a feature on its own (so that the type is unique within that feature).
    I have found articles that suggest that all list definitions should be given a unique type value (conventionally above 10000) and other articles that seem to suggest using the SharePoint built-in list types is valid.
    Is the choice of type based upon whether I need to be able to differentiate my lists in the future or are there other technical reasons for preferring one method over the other ?
    Thank you in advance for your advice as I hope it will prevent me choosing a wrong strategy (or picking up bad habits).

    Greetings,
    what I have done so far is :
    1. Create site columns declaratively and deploy in a feature.
    2. Create content types declaratively and deploy in a feature including a custom feature receiver to prime the content type (which if I understood correctly should propagate changes to the content types to lists).
    <?xml version="1.0" encoding="utf-8"?>
    <Elements xmlns="http://schemas.microsoft.com/sharepoint/">
    <!-- Parent ContentType: Document (0x0101) -->
    <ContentType ID="0x010100D0DBA4954E79485287BB9FDD2FD32BD3" Name="KGEngBasicDoc" Group="KG" Description="Default KG Engagament Document" Overwrite="TRUE" Inherits="TRUE" Version="0">
    <FieldRefs>
    <FieldRef ID="{c788a2de-9005-4fbf-a80f-ff570e9e8ebb}" DisplayName="KG Correspondent" Required="FALSE" Name="KGCorrespondent" />
    <FieldRef ID="{4F24D5B8-436C-4A5F-AA1F-B3E66E72576B}" DisplayName="KGCorrespondent_0" Required="FALSE" Hidden="TRUE" Name="KGCorrespondentTaxHTField0" />
    <FieldRef ID="{9e3713d9-3004-4b53-9999-3fc1dbabf88e}" DisplayName="KGDocType" Required="FALSE" Name="KGDocType" />
    <FieldRef ID="{b471df76-40df-463b-9881-bc438cd3d7f3}" DisplayName="KGDocType_0" Required="FALSE" Hidden="TRUE" Name="KGDocTypeTaxHTField0" />
    <FieldRef ID="{ecc70efc-db96-407e-b9fd-d64a3c3a3345}" DisplayName="KGRecipient" Required="FALSE" Name="KGRecipient" />
    <FieldRef ID="{b2170479-32ec-42ee-b12e-3f10c5357c82}" DisplayName="KGRecipient_0" Required="FALSE" Hidden="TRUE" Name="KGRecipientTaxHTField0" />
    <FieldRef ID="{8aa58e8e-38e0-4b04-bcf8-d0c8000e5b36}" DisplayName="KGTasksAndMatters" Required="FALSE" Name="KGTasksAndMatters" />
    <FieldRef ID="{e40d1dd3-731d-4641-9e1e-2eef51f9889b}" DisplayName="KGTasksAndMatters_0" Required="FALSE" Hidden="TRUE" Name="KGTasksAndMattersTaxHTField0" />
    <FieldRef ID="{6150e127-ea5a-4f92-b1f9-b3b966fd67a5}" DisplayName="KGEngagementID" Required="FALSE" Name="KGEngagementID" />
    <FieldRef ID="{983c6a7b-7545-4163-bc05-3afd1b380ad5}" DisplayName="KGEngagementID_0" Required="FALSE" Hidden="TRUE" Name="KGEngagementIDTaxHTField0" />
    <FieldRef ID="{f3b0adf9-c1a2-4b02-920d-943fba4b3611}" DisplayName="Taxonomy Catch All Column" Required="FALSE" Hidden="TRUE" Name="TaxCatchAll" Sealed="TRUE" Sortable="FALSE" />
    <FieldRef ID="{8f6b6dd8-9357-4019-8172-966fcd502ed2}" DisplayName="Taxonomy Catch All Column1" Required="FALSE" Hidden="TRUE" Name="TaxCatchAllLabel" ReadOnly="TRUE" Sealed="TRUE" Sortable="FALSE" />
    </FieldRefs>
    </ContentType>
    </Elements>
    3. Create list definition declaratively, each in their own feature. (Since I wanted to be able to deploy views as well as allowing users to select lists of my custom 'type' to create adhoc, I thought I needed to create list definitions.)
    Note : This is the bit my question was referring to and currently I am using type id 101 instead of the custom type 100042 as I wanted them to be detected as document libraries by various third party
    products.
    ELEMENTS.XML
    <?xml version="1.0" encoding="utf-8" ?>
    <Elements xmlns="http://schemas.microsoft.com/sharepoint/">
    <!-- Do not change the value of the Name attribute below. If it does not match the folder name of the List project item, an error will occur when the project is run. -->
    <ListTemplate
    Name="KGEngagementLibrary"
    Type="101"
    BaseType="1"
    OnQuickLaunch="TRUE"
    SecurityBits="11"
    Sequence="110"
    DisplayName="KGEngagementLibrary"
    Description="KG Engagement Documents"
    Image="/_layouts/15/images/itdl.png"
    DocumentTemplate="121"/>
    </Elements>
    SCHEMA.XML
    <?xml version="1.0" encoding="utf-8"?>
    <List xmlns:ows="Microsoft SharePoint" Title="KGEngagementLibrary" Direction="$Resources:Direction;" Url="KGEngagementLibrary" BaseType="1" xmlns="http://schemas.microsoft.com/sharepoint/" EnableContentTypes="TRUE">
    <MetaData>
    <ContentTypes>
    <ContentType ID="0x010100D0DBA4954E79485287BB9FDD2FD32BD3" Name="KGEngBasicDoc" Group="KG" Description="Default KG Engagament Document" Inherits="TRUE" Version="0"><FieldRefs><FieldRef ID="{c788a2de-9005-4fbf-a80f-ff570e9e8ebb}" DisplayName="KG Correspondent" Required="FALSE" Name="KGCorrespondent" /><FieldRef ID="{4F24D5B8-436C-4A5F-AA1F-B3E66E72576B}" DisplayName="KGCorrespondent_0" Required="FALSE" Hidden="TRUE" Name="KGCorrespondentTaxHTField0" /><FieldRef ID="{9e3713d9-3004-4b53-9999-3fc1dbabf88e}" DisplayName="KGDocType" Required="FALSE" Name="KGDocType" /><FieldRef ID="{b471df76-40df-463b-9881-bc438cd3d7f3}" DisplayName="KGDocType_0" Required="FALSE" Hidden="TRUE" Name="KGDocTypeTaxHTField0" /><FieldRef ID="{ecc70efc-db96-407e-b9fd-d64a3c3a3345}" DisplayName="KGRecipient" Required="FALSE" Name="KGRecipient" /><FieldRef ID="{b2170479-32ec-42ee-b12e-3f10c5357c82}" DisplayName="KGRecipient_0" Required="FALSE" Hidden="TRUE" Name="KGRecipientTaxHTField0" /><FieldRef ID="{8aa58e8e-38e0-4b04-bcf8-d0c8000e5b36}" DisplayName="KGTasksAndMatters" Required="FALSE" Name="KGTasksAndMatters" /><FieldRef ID="{e40d1dd3-731d-4641-9e1e-2eef51f9889b}" DisplayName="KGTasksAndMatters_0" Required="FALSE" Hidden="TRUE" Name="KGTasksAndMattersTaxHTField0" /><FieldRef ID="{6150e127-ea5a-4f92-b1f9-b3b966fd67a5}" DisplayName="KGEngagementID" Required="FALSE" Name="KGEngagementID" /><FieldRef ID="{983c6a7b-7545-4163-bc05-3afd1b380ad5}" DisplayName="KGEngagementID_0" Required="FALSE" Hidden="TRUE" Name="KGEngagementIDTaxHTField0" /><FieldRef ID="{f3b0adf9-c1a2-4b02-920d-943fba4b3611}" DisplayName="Taxonomy Catch All Column" Required="FALSE" Hidden="TRUE" Name="TaxCatchAll" Sealed="TRUE" Sortable="FALSE" /><FieldRef ID="{8f6b6dd8-9357-4019-8172-966fcd502ed2}" DisplayName="Taxonomy Catch All Column1" Required="FALSE" Hidden="TRUE" Name="TaxCatchAllLabel" ReadOnly="TRUE" Sealed="TRUE" Sortable="FALSE" /></FieldRefs></ContentType><ContentTypeRef ID="0x0101">
    <Folder TargetName="Forms/Document" />
    </ContentTypeRef><ContentTypeRef ID="0x0120" /></ContentTypes>
    ETC..
    4. Deploy list instances programmatically using event receiver.
    Note : The highlighted bits relate to the type and feature id used in my content type deployment.
    public override void FeatureActivated(SPFeatureReceiverProperties properties)
    SPWeb web = properties.Feature.Parent as SPWeb;
    try
    SPList list = null;
    list = null;
    foreach (SPList _list in web.Lists)
    if (_list.Title.Equals("Administration"))
    list = _list;
    if (list == null)
    web.AllowUnsafeUpdates = true;
    Guid listID = web.Lists.Add("Administration", //List Title
    "Administration documents", //List Description
    "Lists/Administration", //List Url
    "8ba84f44-fe8c-4789-a7dc-d264154041d2", //Feature Id of List definition Provisioning Feature – CustomList Feature Id
    101, //List Template Type
    "101"); //Document Template Type .. 100 is for None
    web.Update();
    web.AllowUnsafeUpdates = false;
    catch (Exception ex)
    The whole point of trying to create list definitions was that this seemed to be the only way for me to provide customized views for users at list creation time.  If it wasn't for that then I think I could have created all of
    these elements programmatically instead.
    (I could not figure out how to create a list definition programmatically).
    Please let me know what I should or shouldn't be doing in this deployment chain.
    Thanks !!

  • Visual Studio 2013 is creating new feature every time new list definition is added

    We are using Visual Studio 2013 and details are as under:
    Microsoft Visual Studio Ultimate 2013
    Version 12.0.30501.00 Update 2
    We we add a new list definition in our project, it creates a new feature with it. If we delete the feature and add list definition in the existing feature, list is created but columns are not added in the list.
    Same thing happened if we rename "Feature1", a new feature is created every time a new list definition is created.
    This doesn't happen when we add a Visual WebPart.
    Also, we have three different custom list option in the drop down in new list creating wizard.
    Is this a bug or we are doing something different.   
    http://farhanfaiz.wordpress.com

    Intellisense has a bug in VS2013 where it doesn't recognize InitializeComponent when you start working on the XAML.  My feeling is that if you try to compile this app, it will run fine (as long as there are no actual errors).
    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.
    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined
    objects and unknown namespaces.

  • Issue in Custom Blog site definition based on SharePoint 2010 blog site definition after migrating the sites to SharePoint 2013 and site collection upgrade

    I have created a custom blog site definition using SharePoint 2010 blog site definition with Configuration ID 31 in onet.xml (new value). This was working fine for SharePoint 2010.
    We created new SharePoint 2013 farm and deployed the all Custom solutions in
    14/15 folders. After migrating the sites to SharePoint 2013 using Content DB approach, site created previously using my custom definition are working fine.
    But after running site collection upgrade these sites stop working. When I post a comment then comments not getting listed on post detail page. However comments are getting added to Comments List but
    PostTitle column  of Comment is not getting populated.
    Also, when we create a new site in SharePoint 2013 using my custom blog template then that is also not getting provisioned.  default.aspx and look-up between post and comment list are not working.
    If any one has faced such issue then please share your findings and any solution to fix this.
    Thanks in Advance :)

    Hi ,
    According to your description, my understanding is that the blog based on custom blog site definition didn’t work correctly after migrating custom blog site definition to SharePoint 2013.
    If you customized the Onet.xml file in a previous version's site definition, you should modify some sections in the file to work in the current version, like  <BaseTypes> and  <ListTemplate>  etc. More information, please refer
    to the link below:
    http://msdn.microsoft.com/en-us/library/office/aa543837(v=office.14).aspx
    For that the PostTitle column  of Comment is not getting populated, please try to modify the view, then compare the result.
    I hope this helps.
    Thanks,
    Wendy
    Wendy Li
    TechNet Community Support

  • [Forum FAQ] How to install and configure Windows Server Essentials Experience role on Windows Server 2012 R2 Standard via PowerShell locally and remotely

    As we all know,
    the Windows Server Essentials Experience role is available in Windows Server 2012 R2 Standard and Windows Server 2012 R2 Datacenter. We can add the Windows Server
    Essentials Experience role in Server Manager or via Windows PowerShell.
    In this article, we introduce the steps to install and configure Windows
    Server Essentials Experience role on Windows Server 2012 R2 Standard via PowerShell locally and remotely. For better analyze, we divide this article into two parts.
    Before installing the Windows Server Essentials Experience Role, please use
    Get-WindowsFeature
    PowerShell cmdlet to ensure the Windows Server Essentials Experience (ServerEssentialsRole) is available. (Figure 1)
    Figure 1.
    Part 1: Install Windows Server Essentials Experience role locally
    Add Windows Server Essentials Experience role
    Run Windows PowerShell as administrator, then type
    Add-WindowsFeature ServerEssentialsRole cmdlet to install Windows Server Essentials Experience role. (Figure 2)
    Figure 2.
    Note: It is necessary to configure Windows Server Essentials Experience (Post-deployment Configuration). Otherwise, you will encounter following issue when opening Dashboard.
    (Figure 3)
    Figure 3.
      2. Configure Windows Server Essentials Experience role
    (1)  In an existing domain environment
    Firstly, please join the Windows Server 2012 R2 Standard computer to the existing domain through the path:
    Control Panel\System\Change Settings\”Change…”\Member of. (Figure 4)
    Figure 4.
    After that, please install Windows Server Essentials Experience role as original description. After installation completed, please use the following command to configure Windows
    Server Essentials:
    Start-WssConfigurationService –Credential <Your Credential>
    Note: The type of
    Your Credential should be as: Domain-Name\Domain-User-Account.
    You must be a member of the Enterprise Admin group and Domain Admin group in Active Directory when using the command above to configure Windows Server Essentials. (Figure 5)
    Figure 5.
    Next, you can type the password for the domain account. (Figure 6)
    Figure 6.
    After setting the credential, please type “Y” to continue to configure Windows Server Essentials. (Figure 7)
    Figure 7.
    By the way, you can use
    Get-WssConfigurationStatus
    PowerShell cmdlet to
    get the status of the configuration of Windows Server Essentials. Specify the
    ShowProgress parameter to view a progress indicator. (Figure 8)
    Figure 8.
    (2) In a non-domain environment
    Open PowerShell (Run as Administrator) on the Windows Server 2012 R2 Standard and type following PowerShell cmdlets: (Figure 9)
    Start-WssConfigurationService -CompanyName "xxx" -DNSName "xxx" -NetBiosName "xxx" -ComputerName "xxx” –NewAdminCredential $cred
    Figure 9.
    After you type the commands above and click Enter, you can create a new administrator credential. (Figure 10)
    After creating the new administrator credential, please type “Y” to continue to configure Windows Server Essentials. (Figure 11)
    After a reboot, all the configurations will be completed and you can open the Windows Server Essentials Dashboard without any errors. (Figure 12)
    Figure 12.
    Please click to vote if the post helps you. This can be beneficial to other community members reading the thread.

    Part 2: Install and configure Windows Server Essentials Experience role remotely
    In an existing domain environment
    In an existing domain environment, please use following command to provide credential and then add Server Essentials Role: (Figure 13)
    Add-WindowsFeature -Name ServerEssentialsRole
    -ComputerName xxx -Credential DomainName\DomainAccount
    Figure 13.
    After you enter the credential, it will start install Windows Server Essentials role on your computer. (Figure 14)
    Figure 14.
    After the installation completes, it will return the result as below:
    Figure 15.
    Next, please use the
    Enter-PSSession
    cmdlet and provide the correct credential to start an interactive session with a remote computer. You can use the commands below:
    Enter-PSSession –ComputerName
    xxx –Credential DomainName\DomainAccount (Figure 16)
    Figure 16.
    Then, please configure Server Essentials Role via
    Add-WssConfigurationService cmdlet and it also needs to provide correct credential. (Figure 17)
    Figure 17.
    After your credential is accepted, it will update and prepare your server. (Figure 18)
    Figure 18.
    After that, please type “Y” to continue to configure Windows Server Essentials. (Figure 19)
    Figure 19.
    2. In a non-domain environment
    In my test environment, I set up two computers running Windows Server 2012 R2 Standard and use Server1 as a target computer. The IP addresses for the two computers are as
    below:
    Sevrer1: 192.168.1.54
    Server2: 192.168.1.53
    Run
    Enable-PSRemoting –Force on Server1. (Figure 20)
    Figure 20.
    Since there is no existing domain, it is necessary to add the target computer (Server1) to a TrustedHosts list (maintained by WinRM) on Server 2. We can use following command
    to
    add the TrustedHosts entry:
    Set-Item WSMan:\localhost\Client\TrustedHosts IP-Address
    (Figure 21)
    Figure 21.
    Next, we can use
    Enter-PSSession
    cmdlet and provide the correct credential to start an interactive session with the remote computer. (Figure 22)
    Figure 22.
    After that, you can install Windows Server Essentials Experience Role remotely via Add-WindowsFeature ServerEssentialsRole cmdlet. (Figure 23)
    Figure 23.
    From figure 24, we can see that the installation is completed.
    Figure 24.
    Then you can use
    Start-WssConfigurationService cmdlet to configure Essentials Role and follow the steps in the first part (configure Windows Server Essentials Experience in a non-domain environment) as the steps would be the same.
    The figure below shows the status of Windows Server Essentials.
    Figure
    25.
    Finally, we have successfully configured Windows Server Essentials on Server1. (Figure 26)
    Figure 26.
    More information:
    [Forum
    FAQ] Introduce Windows Powershell Remoting
    Windows Server Essentials Setup Cmdlets
    Please click to vote if the post helps you. This can be beneficial to other community members reading the thread.

  • How to map a custom enum list to a custom form property in an extended incident class

    Hi,
    I'm struggeling to understand how to map a custom enum list to a custom form property in an extended incident class.
    Here's what i want to have happen:
    I am going to publish a request offering on my SMPortal for allowing users to submit basic IT incidents. I want the form to include "Whom does this problem affect" (answers(This is the custom enum list): Me, Multiple Users, Whole department or Whole
    company), "What is the problem about", "Description" and "Attachments".
    Here's what i've done:
    In the authoring tool i created a MP for the custom enum list and put only the list in it. I sealed the MP and imported it.
    I created another unsealed MP called TST.Incident.Library for storing incident library customizations and extended the incident class to add an extension class i called ClassExtension_Affected scope with a custom property i called AffectedScope. Then i am trying
    to set the datatype of this property to "list". In the "select a list" dialog i cannot chose my previously sealed MP with the custom enum list in it. Why?
    - Do i need to scratch the sealed MP and put the custom enum list in the latter TST.Incident.Library MP instead?
    - If so, can i do that and keep this MP unsealed, or will i get an error on import saying "Unsealed management packs should not contain type definitions"
    - Should i create one sealed MP for both the custom enum list and the extension class + custom property?

    Hi,
    Authoring Tool simply isn't informed about your list. Open the sealed management pack where you define the root of the list in the Authoring Tool and in the same time open TST.Incident.Library. You will have two opened MPs in the Authoring
    Tool and be able to add a custom list for your custom field.
    Cheers,
    Marat
    Site: www.scutils.com  Twitter:
      LinkedIn:
      Facebook:

  • How to use Meta Data in List Definition

    Hi there, In Custom List , I could create a Meta Data Column by UI, but don't know how to create a Meta Data column in my list definition by programming anyone has experiense? -Regards, Chi

    Yeah, it's tricky creating a metadata column in CAML. You can do it, but it still requires a bit of code to wire up the column during feature activation. 
    Basically, you need to define your taxonomy field (and a hidden field for the label), include the taxonomy catchall fields (in your list definition), add an event handler to the list definition (that will update the taxonomy catch all fields when items are
    added and updated), and then wire up your taxonomy field during feature activation (this is when you would check if the termset has been created, and assign the termset id to the field, etc).
    Here's an example from a test project I created (with help from others). I've posted the whole project up to the TechNet Gallery, here:
    http://gallery.technet.microsoft.com/Declaratively-Adding-c4dc6c81.
    Column Markup:
    <?xml version="1.0" encoding="utf-8"?>
    <Elements xmlns="http://schemas.microsoft.com/sharepoint/">
    <Field
    ID="{14c4e3ff-5d11-4412-a7ae-287f187d5eef}" Name="inceAnimal" DisplayName="Animal" StaticName="inceAnimal" Type="TaxonomyFieldType"
    Required="FALSE" Group="Ince Managed Fields" SourceID="http://schemas.microsoft.com/sharepoint/v3" ShowField="Term1033">
    <Customization>
    <ArrayOfProperty>
    <Property>
    <Name>TextField</Name>
    <Value xmlns:q6="http://www.w3.org/2001/XMLSchema" p4:type="q6:string" xmlns:p4="http://www.w3.org/2001/XMLSchema-instance">{24c4e3ff-5d11-4412-a7ae-287f187d5fff}</Value>
    </Property>
    </ArrayOfProperty>
    </Customization>
    </Field>
    <Field Type="Note" ID="{24c4e3ff-5d11-4412-a7ae-287f187d5fff}" Name="inceAnimalTaxHTField0" DisplayName="Animal_0" StaticName="inceAnimalTaxHTField0" ShowInViewForms="FALSE" Hidden="TRUE"
    RowOrdinal="0"/>
    </Elements>
    Content Type:
    <?xml version="1.0" encoding="utf-8"?>
    <Elements xmlns="http://schemas.microsoft.com/sharepoint/">
    <!-- Parent ContentType: Item (0x01) -->
    <ContentType ID="0x01001D68D1E8F73D4ED5BF5259CF2BCF5209" Name="Animal" Group="Ince Content Types" Description="A content type for storing information on animals." Inherits="TRUE" Version="0">
    <FieldRefs>
    <FieldRef ID="{14c4e3ff-5d11-4412-a7ae-287f187d5eef}" DisplayName="Animal" Required="FALSE" Name="inceAnimal" />
    <FieldRef ID="{24c4e3ff-5d11-4412-a7ae-287f187d5fff}" DisplayName="Animal_0" Hidden="TRUE" Name="inceAnimalTaxHTField0" />
    <FieldRef ID="{f3b0adf9-c1a2-4b02-920d-943fba4b3611}" Name="TaxCatchAll"/>
    <FieldRef ID="{8f6b6dd8-9357-4019-8172-966fcd502ed2}" Name="TaxCatchAllLabel"/>
    </FieldRefs>
    </ContentType>
    </Elements>
    List Definition (Elements.xml):
    <?xml version="1.0" encoding="utf-8"?>
    <Elements xmlns="http://schemas.microsoft.com/sharepoint/">
    <!-- Do not change the value of the Name attribute below. If it does not match the folder name of the List project item, an error will occur when the project is run. -->
    <ListTemplate
    Name="ldAnimal"
    Type="14000"
    BaseType="0"
    OnQuickLaunch="TRUE"
    SecurityBits="11"
    Sequence="410"
    DisplayName="Animals"
    Description="List for recording animals"
    Image="/_layouts/images/itgen.png"/>
    </Elements>
    List Definition (Schema.xml)
    <?xml version="1.0" encoding="utf-8"?>
    <List xmlns:ows="Microsoft SharePoint" Title="ldAnimal" FolderCreation="FALSE" Direction="$Resources:Direction;" Url="Lists/ldAnimal" BaseType="0" xmlns="http://schemas.microsoft.com/sharepoint/" EnableContentTypes="TRUE">
    <MetaData>
    <ContentTypes>
    <ContentType ID="0x01001D68D1E8F73D4ED5BF5259CF2BCF5209" Name="Animal" Group="Ince Content Types" Description="A content type for storing information on animals." Inherits="TRUE" Version="0">
    <FieldRefs>
    <FieldRef ID="{14c4e3ff-5d11-4412-a7ae-287f187d5eef}" DisplayName="Animal" Required="FALSE" Name="inceAnimal" />
    <FieldRef ID="{24c4e3ff-5d11-4412-a7ae-287f187d5fff}" DisplayName="Animal_0" Hidden="TRUE" Name="inceAnimalTaxHTField0" />
    <FieldRef ID="{f3b0adf9-c1a2-4b02-920d-943fba4b3611}" Name="TaxCatchAll"/>
    <FieldRef ID="{8f6b6dd8-9357-4019-8172-966fcd502ed2}" Name="TaxCatchAllLabel"/>
    </FieldRefs>
    </ContentType>
    </ContentTypes>
    <Fields>
    <Field ID="{fa564e0f-0c70-4ab9-b863-0177e6ddd247}" Type="Text" Name="Title" DisplayName="$Resources:core,Title;" Required="TRUE" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="Title" MaxLength="255" />
    <Field ID="{14c4e3ff-5d11-4412-a7ae-287f187d5eef}" Name="inceAnimal" DisplayName="Animal" StaticName="inceAnimal" Type="TaxonomyFieldType" Required="FALSE" Group="Ince Managed Fields" SourceID="http://schemas.microsoft.com/sharepoint/v3">
    <Customization>
    <ArrayOfProperty>
    <Property>
    <Name>TextField</Name>
    <Value xmlns:q6="http://www.w3.org/2001/XMLSchema" p4:type="q6:string" xmlns:p4="http://www.w3.org/2001/XMLSchema-instance">{24c4e3ff-5d11-4412-a7ae-287f187d5fff}</Value>
    </Property>
    </ArrayOfProperty>
    </Customization>
    </Field>
    <Field Type="Note" ID="{24c4e3ff-5d11-4412-a7ae-287f187d5fff}" Name="inceAnimalTaxHTField0" DisplayName="Animal_0" StaticName="inceAnimalTaxHTField0" ShowInViewForms="FALSE" Hidden="TRUE" RowOrdinal="0"/>
    </Fields>
    <Views>
    <View BaseViewID="0" Type="HTML" MobileView="TRUE" TabularView="FALSE">
    <Toolbar Type="Standard" />
    <XslLink Default="TRUE">main.xsl</XslLink>
    <RowLimit Paged="TRUE">30</RowLimit>
    <ViewFields>
    <FieldRef Name="LinkTitleNoMenu"></FieldRef>
    </ViewFields>
    <Query>
    <OrderBy>
    <FieldRef Name="Modified" Ascending="FALSE"></FieldRef>
    </OrderBy>
    </Query>
    <ParameterBindings>
    <ParameterBinding Name="AddNewAnnouncement" Location="Resource(wss,addnewitem)" />
    <ParameterBinding Name="NoAnnouncements" Location="Resource(wss,noXinviewofY_LIST)" />
    <ParameterBinding Name="NoAnnouncementsHowTo" Location="Resource(wss,noXinviewofY_ONET_HOME)" />
    </ParameterBindings>
    </View>
    <View BaseViewID="1" Type="HTML" WebPartZoneID="Main" DisplayName="$Resources:core,objectiv_schema_mwsidcamlidC24;" DefaultView="TRUE" MobileView="TRUE" MobileDefaultView="TRUE" SetupPath="pages\viewpage.aspx" ImageUrl="/_layouts/images/generic.png" Url="AllItems.aspx">
    <Toolbar Type="Standard" />
    <XslLink Default="TRUE">main.xsl</XslLink>
    <RowLimit Paged="TRUE">30</RowLimit>
    <ViewFields>
    <FieldRef Name="Attachments"></FieldRef>
    <FieldRef Name="LinkTitle"></FieldRef>
    <FieldRef Name="inceAnimal" />
    </ViewFields>
    <Query>
    <OrderBy>
    <FieldRef Name="ID"></FieldRef>
    </OrderBy>
    </Query>
    <ParameterBindings>
    <ParameterBinding Name="NoAnnouncements" Location="Resource(wss,noXinviewofY_LIST)" />
    <ParameterBinding Name="NoAnnouncementsHowTo" Location="Resource(wss,noXinviewofY_DEFAULT)" />
    </ParameterBindings>
    </View>
    </Views>
    <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>
    </MetaData>
    </List>
    Taxonomy List Event Receiver Markup:
    <?xml version="1.0" encoding="utf-8"?>
    <Elements xmlns="http://schemas.microsoft.com/sharepoint/">
    <Receivers ListTemplateId="14000" ListUrl="Lists/ldAnimal">
    <Receiver>
    <Name>TaxonomyItemSynchronousAddedEventReceiver</Name>
    <Type>ItemAdding</Type>
    <Assembly>Microsoft.SharePoint.Taxonomy, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c</Assembly>
    <Class>Microsoft.SharePoint.Taxonomy.TaxonomyItemEventReceiver</Class>
    <Synchronization>Synchronous</Synchronization>
    <SequenceNumber>10000</SequenceNumber>
    </Receiver>
    <Receiver>
    <Name>TaxonomyItemUpdatingEventReceiver</Name>
    <Type>ItemUpdating</Type>
    <Assembly>Microsoft.SharePoint.Taxonomy, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c</Assembly>
    <Class>Microsoft.SharePoint.Taxonomy.TaxonomyItemEventReceiver</Class>
    <Synchronization>Synchronous</Synchronization>
    <SequenceNumber>10000</SequenceNumber>
    </Receiver>
    </Receivers>
    </Elements>
    Feature Activation Code:
    [Guid("8b0a27ee-22dd-4a4e-940e-9cce3a596c49")]
    public class AnimalFieldsandContentTypeEventReceiver : SPFeatureReceiver
    private const String TermGroupName = "Zoology";
    private const String TermSetName = "Animals";
    private readonly Guid _termSetId = new Guid("{8CC56BE3-93A0-4007-81AF-30EB39A42959}");
    private readonly Guid _animalFiedId = new Guid("{14c4e3ff-5d11-4412-a7ae-287f187d5eef}");
    private const String ClassName = "AnimalFieldsandContentTypeEventReceiver";
    public override void FeatureActivated(SPFeatureReceiverProperties properties)
    try
    Logging.Log(String.Format("{0}.FeatureActivated", ClassName), String.Format("Activating feature."), LogType.Information);
    var site = properties.Feature.Parent as SPSite;
    if (site == null)
    Logging.Log(ClassName, "The Site is null. Feature not activated.", LogType.Error);
    throw new NullReferenceException("The Site is null. Couldn't activate the feature.");
    var termStore = Taxonomy.GetDefaultTermStore(site);
    if (termStore == null)
    Logging.Log(ClassName, "The Taxonomy Termstore is null. Feature not activated.", LogType.Error);
    throw new NullReferenceException("The Taxonomy Termstore is null. Feature not activated.");
    var termGroup = Taxonomy.GetTermGroup(termStore, TermGroupName, true);
    var termSet = Taxonomy.GetTermSet(termGroup, TermSetName, _termSetId, true);
    Taxonomy.ConnectTaxonomyTerm(site, termSet, termGroup, _animalFiedId);
    Logging.Log(String.Format("{0}.FeatureActivated", ClassName), String.Format("Successfully activated feature."), LogType.Information);
    catch (Exception e)
    Logging.Log(String.Format("{0}.FeatureActivated", ClassName), String.Format("Unexpected error activating the feature. Error: {0}", e.Message), LogType.Error);
    throw;
    Taxonomy Helper Class:
    namespace TaxonomyTesting
    public class Taxonomy
    private const String ClassName = "Taxonomy";
    public static TermStore GetDefaultTermStore(SPSite site)
    var taxonomySession = new TaxonomySession(site);
    var termStore = taxonomySession.DefaultSiteCollectionTermStore;
    if (termStore != null) return termStore;
    return taxonomySession.TermStores.Count == 0 ? null : taxonomySession.TermStores[0];
    public static TermSet GetTermSet(Group group, String termsetName, Guid termsetId, Boolean createIfMissing)
    try
    foreach (var termSet in @group.TermSets.Where(set => set.Name.ToLower().Equals(termsetName.ToLower())))
    return termSet;
    if (createIfMissing)
    Logging.Log(String.Format("{0}.GetTermSet", ClassName), String.Format("Termset does not exist. Creating termset: {0}", termsetName), LogType.Information);
    var termSet = group.CreateTermSet(termsetName, termsetId, 1033);
    group.TermStore.CommitAll();
    Logging.Log(String.Format("{0}.GetTermSet", ClassName), String.Format("Successfully create termset: {0}", termsetName), LogType.Information);
    return termSet;
    return null;
    catch (Exception e)
    Logging.Log(String.Format("{0}.GetTermSet", ClassName), String.Format("Unexpected error getting a termset. Error: {0}", e.Message), LogType.Error);
    throw new Exception("[GetTermSet] Exception getting term set.");
    public static Group GetTermGroup(TermStore store, String groupName, Boolean createIfMissing)
    try
    foreach (var termGroup in @store.Groups.Where(termGroup => termGroup.Name.ToLower().Equals(groupName.ToLower())))
    return termGroup;
    if(createIfMissing)
    Logging.Log(String.Format("{0}.GetTermGroup", ClassName), String.Format("Termgroup does not exist. Creating term store group: {0}", groupName), LogType.Information);
    store.CreateGroup(groupName);
    store.CommitAll();
    Logging.Log(String.Format("{0}.GetTermGroup", ClassName), String.Format("Successfully create term store group: {0}", groupName), LogType.Information);
    return store.Groups[groupName];
    return null;
    catch (Exception e)
    Logging.Log(String.Format("{0}.GetTermGroup", ClassName), String.Format("Unexpected error getting a term store group. Error: {0}", e.Message), LogType.Error);
    throw new Exception("[GetTermGroup] Exception getting term store group.");
    public static void ConnectTaxonomyTerm(SPWeb web, TermSet termSet, Group termGroup, Guid taxonomyFieldId)
    if (web.Fields.Contains(taxonomyFieldId))
    var field = web.Fields[taxonomyFieldId] as TaxonomyField;
    if (field == null)
    throw new ArgumentException(String.Format("The field with id {0} is not a TaxonomyField.",taxonomyFieldId));
    field.SspId = termSet.TermStore.Id;
    field.TermSetId = termSet.Id;
    field.TargetTemplate = String.Empty;
    field.AnchorId = Guid.Empty;
    field.Update(true);
    return;
    throw new ArgumentException(String.Format("The field with id {0} could not be found on the current web, {1}", taxonomyFieldId, web.Url));
    public static void ConnectTaxonomyTerm(SPSite site, TermSet termSet, Group termGroup, Guid taxonomyFieldId)
    ConnectTaxonomyTerm(site.RootWeb, termSet, termGroup, taxonomyFieldId);
    Logging class (just a helper class, that isn't required if you don't want to log to the ULS)
    namespace TaxonomyTesting
    public static class Logging
    private const String SolutionName = "TaxonomyTesting";
    public static void Log(String callingClass, String message, LogType logType)
    switch (logType)
    case LogType.Error:
    SPDiagnosticsService.Local.WriteTrace(0, new SPDiagnosticsCategory(SolutionName, TraceSeverity.Unexpected, EventSeverity.ErrorCritical), TraceSeverity.Unexpected, String.Format("[{0}][{1}] [Error] {2}", SolutionName, callingClass, message), message);
    return;
    case LogType.Warning:
    SPDiagnosticsService.Local.WriteTrace(0, new SPDiagnosticsCategory(SolutionName, TraceSeverity.High, EventSeverity.Warning), TraceSeverity.High, String.Format("[{0}][{1}] [Warning] {2}", SolutionName, callingClass, message), message);
    return;
    case LogType.Information:
    SPDiagnosticsService.Local.WriteTrace(0, new SPDiagnosticsCategory(SolutionName, TraceSeverity.Medium, EventSeverity.Information), TraceSeverity.Medium, String.Format("[{0}][{1}] {2}", SolutionName, callingClass, message), message);
    return;
    public enum LogType
    Information,
    Warning,
    Error
    Regards, Matthew
    MCPD | MCITP
    My Blog
    View
    Matthew Yarlett's profile
    See my webpart on the TechNet Gallery that allows administrative users to upload, crop and format user profile photos. Check it out here:
    Upload and Crop User Profile Photos

  • I have custom sharepoint list and i have displayed this list on sharepoint webpage as a webpart.

    Hi,
    i have custom sharepoint list and i have displayed this list on sharepoint webpage as a webpart.
    now, i want to display limited sharepoint list items in that webpart and remainig items i want to show in read more link in right bottom of the webpart.
    Any one help me how to do this

    Hello,
    As i understand you want to add read more link for rest of items in listview webpart. You can create new view and set item limit in that view then add that list as webpart on webpart-->edit your webpart-->select view from view selection dropdpwn-->
    save it
    Later add one CEWP and use html <a> tag to redirect to your main list when clicks on it. Here is the steps to do this:
    https://social.msdn.microsoft.com/Forums/sharepoint/en-US/a9d036ff-04a8-4235-84a5-c90164ff5294/read-more-for-sharepoint-list
    You can also use Jquery/Javascript/ECMA script but above one is OOTB and easy solution
    Hope it could help
    Hemendra:Yesterday is just a memory,Tomorrow we may never see<br/> Please remember to mark the replies as answers if they help and unmark them if they provide no help

  • Creating Calendar List using List definition

    HI,
    How to create a Calendar List based on "List" option in VS 2012 ?
    I have tried the below:
    1) Created custom content type with Events as parent. Added few additional columns
    2) Added a List option, based on default list. Removed the "Item" content type and added the custom content type.
    3) In the List definition and List Instance elements.xml, modified the Type to 106.
    Deployed the solution. The list was created, but it is not a calendar list. What am I missing?
    How to create a Calendar list?
    Thanks

    Hi,
    I had tested with a publishing site using the VS 2012, in the list option, it also contains the calendar based list.
    I didn’t do any other steps, just create an SharePoint 2013-Empty Project, then add new item, select the List option.
    Did you install the Microsoft Office Developer Tools for Visual Studio 2012?
    There are two articles about Prerequisites for creating SharePoint 2013 projects using Visual Studio 2012, you can have a look at them.
    http://blogs.msdn.com/b/timquin/archive/2013/01/22/setting-up-visual-studio-2012-for-sharepoint-2013-development-offline.aspx
    http://blogs.msdn.com/b/how24/archive/2013/03/12/creating-sharepoint-2013-projects-using-visual-studio-2012.aspx
    Thanks,
    Jason
    Jason Guo
    TechNet Community Support

Maybe you are looking for