Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have a list view that should only show when an admin adds the person's username to an "allowed viewers" username column. So, I am thinking to create a calculated column that compares the current-viewing user to the username in the "allowed viewers" column. Then, I will filter the list by the result. If it compares to true, the list item will show. If it compares to false, it will not show.

So my question is, what do I put in the Calculated Column field to compare my "allowed viewers" column (which contains a username) to the current user?

share|improve this question
    
Can't you just set the permission on the list? SharePoint will handle permission trimming for you. –  Hugh Wood Nov 20 '12 at 15:32
    
No, because I am using the list as a template to be set on 100 sites where each site has a different group assigned with rights to manage everything but views. –  BGM Nov 20 '12 at 15:38

1 Answer 1

Okay had a play and basically use "Me".

Either:

// Include domain name
Me

// Remove domain name
RIGHT(Me, LEN(Me) - FIND("\", Me))

Note: Column names are in the format [column]

share|improve this answer
    
can we use calculated columns with multi-select person field ? –  Arsalan Adam Khatri Nov 20 '12 at 15:52
    
Yes, I have seen it done, filter the data perhaps with find? since it is stored as plain text, "Name; Name1; Name2", this part is a little fuzzy but I think it should be fine. –  Hugh Wood Nov 20 '12 at 16:19
    
Uh, how do I use that to compare Me with the username value in the "allowed users" column? The "allowed users" column will be a multi-select field, by the way. –  BGM Nov 20 '12 at 16:23
    
The logic would be something like "if(FIND(ME, [column]) > 0, TRUE, FALSE)" I can't test this on my current setup however. –  Hugh Wood Nov 20 '12 at 16:26
    
Ah, it says I can't use columns defined as username data types for a calculated value... –  BGM Nov 20 '12 at 16:33

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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