1

I have a site that contains a number of lists and libraries many of which has a field that defines what department each item is related to (e.g. image library with department logos, document library with departmental process documents, custom list showing budgets for each department for each year). I have a few web-parts I need to setup for different purposes but all essentially need to show data based on what the current users department is - for example; if someone who has "Marketing" as their department in their user profile then when navigation to a page with my desired web-parts it only shows the "Marketing" materials/data (e.g. only shows the Marketing Logo from images library, only shows Marketing process documents from document library, only shows the budgets for the Marketing department from the budget list etc...).

SO, in short, is there any way of filtering a List Views Web Part, aContent Query Web Part or a Data View Web Part with the value of the current users department?

Kind regards,

John

2 Answers 2

0

There is a solution I used few times but it's not the most elegant one. It is possible to create list views filtered on a Person field based on whether the current user is a member of a group or not.

So this requires your budget customer list (for example) to have a Person field which allows Groups. Then you create a SharePoint group for each department and put relevant users into them.

Then modify your list views as explained in this article http://techtrainingnotes.blogspot.co.uk/2012/10/sharepoint-filtering-view-by-group.html

It is a bit messy because you might need to redo the list view if it's structure changes.

Another option I've been using on some occasions is simply using permissions to show only their department's items to the users. Especially useful if there is a folder structure. Again, groups for each department, and permissions on items (ideally on folders) to only allow this department's members to see them.

0

If you use search, like the Content Search web part, you can use a filter like {DepartmentMP={User.Department}} where DepartmentMP is the Managed Property mapped to the crawled property for the Department filed of the list or library and User.Department is the Department filed from the User Profile.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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