none
Formatting with JSON

    질문

  •  I am using SharePoint 365. Problem with application  Contacts.

    We need to add a link to the column Pager. I did it with JSON Column Formatting. And it working fine. But JSON working only if you switch to a new experience.

    Unfortunately, the standard e-mail field now displayed as <a href="mailto:AnyEmailAddress@gmail.com">AnyEmailAddress@gmail.com</a>  format

    I create the simple text field with the email address. And format it with JSON. As recommended in the example 

    {
        "elmType": "div",
        "children": [
            {
                "elmType": "span",
                "style": {
                    "padding-right": "8px"
                },
                "txtContent": "@currentField"
            },
            {
                "elmType": "a",
                "attributes": {
                    "iconName": "Mail",
                    
                    "href": {
                        "operator": "+",
                        "operands": [
                            "mailto:",
                            "@currentField"
                            
                        ]
                    }
                }
            }
        ]
    }

    it's working but address displayed in the same format 

    <a href="mailto:AnyEmailAddress@gmail.com">AnyEmailAddress@gmail.com</a> 

    Any Idea how I can fix this?

    Thank you

    Konstantin



    • 편집됨 Konstantin007 2018년 5월 14일 월요일 오후 4:44
    2018년 5월 14일 월요일 오후 4:37

모든 응답

  • did you try to re-apply formatting after switching to the modern experience?

    Blog - http://sadomovalex.blogspot.com
    Dynamic CAML queries via C# - https://github.com/sadomovalex/camlex

    2018년 5월 14일 월요일 오후 6:30
  • Yes.  Formatting working for link but not for e-mail :-( 
    2018년 5월 14일 월요일 오후 7:03
  • Hi Konstantin,

    Create a multiple lines of text field like this:

    And add the email address html hyperlink in this field, click Edit Source in the Ribbon:

    Then after saving, it will show a clickable email address without html character:

    And it will not need any Json Formatting any more, this email address is clickable and can be opened with a Email Client.

    Thanks

    Best Regards


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


    Click here to learn more. Visit the dedicated forum to share, explore and talk to experts about Microsoft Teams.

    2018년 5월 15일 화요일 오전 6:01
  • Hi Jerry,

    Thank you for your advice. It perfectly working. Unfortunately, the user who will use this application doesn't know anything about coding. When she will add information, she need only put the e-mail address in the field.   The program should format it in an appropriate way automatically. I will be very appreciated if you will let me know how to fix JSON. Thank you

    Konstantin 


    • 편집됨 Konstantin007 2018년 5월 15일 화요일 오후 12:38
    2018년 5월 15일 화요일 오후 12:38
  • Hi Konstantin,

    Directly insert email address in the single text field without html hyperlink elements like this, this is because single line text field not recognized html elements code:

    And use Json formatting like this:

    {
        "elmType": "div",
        "children": [
            {
                "elmType": "span",
                "style": {
                    "padding-right": "8px"
                },
                "txtContent":  "AnyEmail"
            },
            {
                "elmType": "a",
                "attributes": {
                    "iconName": "Mail",
                    "class": "sp-field-quickAction",
                    "href": {
                        "operator": "+",
                        "operands": [
                            "mailto:",
                            "@currentField"
                        ]
                    }
                }
            }
        ]
    }


    Click the email icon, it will pop up the mail client window like this:

    Thanks

    Best Regards


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


    Click here to learn more. Visit the dedicated forum to share, explore and talk to experts about Microsoft Teams.

    2018년 5월 16일 수요일 오전 6:16
  • Hi Jerry,

    I follow your direction and created a single text field. Put JASON formatting. 

    But in mail client window is a different picture.  Also, have an e-mail address text,
    anyemail

    not a real e-mail is not as usual way.  


    I find another way to work around.

    Create new  field Hyperlink or Picture and chose Format URL as Hyperlink

    It works perfectly it has only one problem the  user must add the word

    mailto:

    in front of address  as on the image below

     

    So it works but needs extra steps. I prefer to use JASON  if it will do what I want. So far it doesn't

    Konstantin


    • 편집됨 Konstantin007 2018년 5월 16일 수요일 오후 4:18
    2018년 5월 16일 수요일 오후 4:15
  • Hi Konstantin,

    Please set the field value with a normal email address without <a href="mailto:AnyEmailAddress@gmail.com"></a>,just set AnyEmailAddress@gmail.com like this:

    Then set the Json formatting:

    {
        "elmType": "div",
        "children": [
            {
                "elmType": "span",
                "style": {
                    "padding-right": "8px"
                },
                "txtContent":  "AnyEmail"
            },
            {
                "elmType": "a",
                "attributes": {
                    "iconName": "Mail",
                    "class": "sp-field-quickAction",
                    "href": {
                        "operator": "+",
                        "operands": [
                            "mailto:",
                            "@currentField"
                        ]
                    }
                }
            }
        ]
    }

    And click the mail icon in the column, it will pop up the email window:

    Thanks

    Best Regards


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


    Click here to learn more. Visit the dedicated forum to share, explore and talk to experts about Microsoft Teams.

    2018년 5월 17일 목요일 오전 2:32
  • Jerry,

    I, of course, set the field value as a normal email address without 

    <a href="mailto: "></a>  block

    but it still has the same problem.

    Konstantin

    2018년 5월 18일 금요일 오후 4:04
  • Hi,

    Please check if the email address hyperlink address is like this in your side when hovering the mail icon when using Json Format, it works in my side:


    Thanks

    Best Regards


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


    Click here to learn more. Visit the dedicated forum to share, explore and talk to experts about Microsoft Teams.

    2018년 5월 21일 월요일 오전 10:11