Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Sören Deger 733 posts 2844 karma points c-trib
    Sep 21, 2014 @ 20:31
    Sören Deger
    0

    How get property type alias from property type id

    Hi,

    how I can get the property type alias from a given property type id with api?

     

    Sören

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Sep 22, 2014 @ 07:14
    Jan Skovgaard
    0

    Hi Sören

    I believe you should use the content service API for that - http://our.umbraco.org/documentation/Reference/Management-v6/Services/ContentService

    Hope this helps.

    /Jan

  • Sören Deger 733 posts 2844 karma points c-trib
    Sep 22, 2014 @ 08:04
    Sören Deger
    0

    Hi Jan,

    with content service I can get a content type. But I have a property id and need the property type alias. I can't found a method for this.

     

    Sören

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Sep 22, 2014 @ 16:58
    Jan Skovgaard
    0

    Hi Sören

    Aaah I see..but what is your scenario? Why do you need to be able to fetch the alias based on an id of a property?

    I mean...the alias for a certain property editor can be many different things...Looking forward to hearing from you :)

    /Jan

  • Sören Deger 733 posts 2844 karma points c-trib
    Sep 22, 2014 @ 17:12
    Sören Deger
    0

    Hi Jan,

    currently I'm developing a new great package for umbraco 7 called mail2cms, which imported emails as umbraco content or media nodes. 

    I already have developed a very extensive custom section for the settings. I can select a document type or a media type for import of mails from a specific mailbox and assign specific email attributes, such as recipient, sender, subject, body, attachments and others to individual document or media type properties. 

    My custom propertyType pickers now give me back the id of property type. This value is the id in cmsPropertyType table. 

    If I import the mails to umbraco I need the propertyTypeAlias ("Alias" in cmsPropertyType table) to save the value of my mail to a specific content or media node with contentService or mediaService.

     

    Sören

  • Sören Deger 733 posts 2844 karma points c-trib
    Sep 22, 2014 @ 17:37
    Sören Deger
    103

    Hi Jan,

    I have solved it with ContentTypeService :-)

    public string GetPropertyTypeAlias(int propTypeId, int docTypeId)
    {
    foreach(var prop in Services.ContentTypeService.GetContentType(docTypeId).PropertyTypes)
            {
                    if(prop.Id==propTypeId)
                   {
                       return prop.Alias;
                   }
               }
               return null;
    }

     

    Sören

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Sep 22, 2014 @ 18:20
    Jan Skovgaard
    0

    Hi Sören

    Very happy that you managed to figure it out and #h5yr for sharing the solution.

    Looking forward to your package release indeed! :)

    /Jan

Please Sign in or register to post replies

Write your reply to:

Draft