1

I have a person/group field in a document library that contains multiple users. Is there a way to set a filter in the library so that only those items that contain my name are displayed?

0

Set the filter in the view and select the person/group field and set the value to [Me]

  • Wow...that was easy. I was thinking because there were multiple people that you had to somehow use the 'contains' operator. Thank you. – RJaxx Jan 13 '16 at 23:32
0

You can go to Modify View in the top ribbon and apply a filter on said column equal to [Me]. I used Created By below, but a person field will work also.

enter image description here

0

How are the groups broken down? Do they have a delimiter ";" between each? Are they stored as an object?

may be overkill for what you require...BUT

in jQuery there is a selector called ":contains()" - perhaps with a custom view you are able to make a ajax call to retrieve these list items and store them in a variable. Then filter this variable where your field "contains('Your name')" and append to a table.

if you wanted the current logged on user to display where there own name is, you can simply make the following ajax call:

let CurrentUserDisplayName

function GetCurrentUserInfo(){
$.ajax({
    url: 'https://**YOURSITE**/sites/**SITE**/_api/web/currentUser',
    type: 'GET',
    headers: {
        accept: 'application/json',
    },
    success: function(data){
        CurrentUserDisplayName = data.Title
        console.log(CurrentUserDisplayName);
    },
    error: function(data, errorCode, errorMessage){
        console.log(errorCode);
        console.log(errorMessage);
    }
})

}

from this you can create a table and filter the array where the field "contains(CurrentUserDisplayName)".

Hope this helps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.