none
SharePoint Online 2013 - Fetch managed metadata column value using jQuery not working for any user other than site administrators

    Question

  • Hi,

    I am fetching values from a managed metadata column from a list in jQuery using REST API. I had referred following article:

    TAXONOMY COLUMNS & SHAREPOINT 2013 LIST REST API

    I have used CAML query to fetch the taxonomy field and displayingTerm label on my page. When a site administrator or owner accesses the page, he can see the Term label but for other users a null value is displayed for the Term label.

    Can anyone please tell me how to fix this issue?

    Thanks,

    Shruti


    Regards, Shruti

    Saturday, March 18, 2017 11:16 AM

Answers

  • Hi,

    I tested with read permission user account and I can get the managed metadata field successfully, make sure your user has read permission(at least) for your list.

     <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script>
        <script type="text/javascript">
            $.ajax({
                url: _spPageContextInfo.webAbsoluteUrl + "/_api/web/Lists/GetByTitle('myList2')/GetItems(query=@v1)?@v1={'ViewXml':'<View><Query/></View>'}",
                type: "POST",
                headers: {
                    "Accept": "application/json;odata=verbose",
                    "X-RequestDigest": $("#__REQUESTDIGEST").val()
                },
    
                success: function (data, textStatus, jqXHR) {
                    console.log(data.d.results[0].Product.Label);
                },
    
                error: function (jqXHR, textStatus, errorThrown) {
                    console.dir(jqXHR);
                }
            });
        </script>

    Best Regards,

    Lee


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

    Monday, March 20, 2017 5:57 AM
  • Thanks Lee for your reply.

    We had added our js files in the style library. One of my colleagues had removed the Style Resource Reader group from the site. When we created another site collection keeping the Style Resource Reader group and added our scripts and MMS column, we did not face this issue at all.

    Looks like Style Resource Reader group has read permission on taxonomyhiddenlist. It is weird that user was able to access MMS value while adding items to the list. The only issue was with the REST call.

    Regards,

    Shruti


    Regards, Shruti

    Monday, March 27, 2017 12:28 PM

All replies

  • Hi,

    I tested with read permission user account and I can get the managed metadata field successfully, make sure your user has read permission(at least) for your list.

     <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script>
        <script type="text/javascript">
            $.ajax({
                url: _spPageContextInfo.webAbsoluteUrl + "/_api/web/Lists/GetByTitle('myList2')/GetItems(query=@v1)?@v1={'ViewXml':'<View><Query/></View>'}",
                type: "POST",
                headers: {
                    "Accept": "application/json;odata=verbose",
                    "X-RequestDigest": $("#__REQUESTDIGEST").val()
                },
    
                success: function (data, textStatus, jqXHR) {
                    console.log(data.d.results[0].Product.Label);
                },
    
                error: function (jqXHR, textStatus, errorThrown) {
                    console.dir(jqXHR);
                }
            });
        </script>

    Best Regards,

    Lee


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

    Monday, March 20, 2017 5:57 AM
  • Thanks Lee for your reply.

    We had added our js files in the style library. One of my colleagues had removed the Style Resource Reader group from the site. When we created another site collection keeping the Style Resource Reader group and added our scripts and MMS column, we did not face this issue at all.

    Looks like Style Resource Reader group has read permission on taxonomyhiddenlist. It is weird that user was able to access MMS value while adding items to the list. The only issue was with the REST call.

    Regards,

    Shruti


    Regards, Shruti

    Monday, March 27, 2017 12:28 PM
  • Hi,

    Thanks for your feedback, you could mark your solution as answer, so it may help other community members find the helpful information quickly.

    Best Regards,

    Lee


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

    Tuesday, March 28, 2017 1:25 AM