Skip to main content

Dear all

 

Is it possible to filter a list-view (used in a sharepoint-site) based on a active-directory group membership? I coudln't find any information regarding this matter in the documentation or the knowledge base or in the community section.

 

Regards

Viktor

Hello Victor,


 


You could use the URM methods getGroupUsers() or findUserGroups() and then based on current user filter as needed etc.


 


Regards,


Matt


Hi Skb_ev


 


See solution below on how to filter  a list-view in sharepoint- site based on an active-directory membership.


Step1:


Go to "SmartObject Service Tester.exe" Path(C:Program FilesK2Bin) and create a SmartObject via "AD Service 2"


Follow the steps : C:Program FilesK2Bin> Double click  "SmartObject Service Tester.exe">Click (+) "ServiceObject Explorer" to collapse>Click (+) "AD Service 2" to Collapse>Right Click AD User>Click "Create SmartObject">Rename "AD User" to "AD User 2">Click "Publish SmartObject"


 


Step2:


Expand (+)"SmartObject Explorer">Expand (+) "All SmartObjects">Check if SmartObject "AD User 2" is created



 


Step3:


From SharePoint side we are going to create a Custom List



Step4:


Create a SmartObject and a List View e.g



 


Step5:


Go to View drag and drop "Data Label" name it "myData Label" and go to Rules e.g



 


Step6:


The Rule must be like this (Each line will be explained in the next steps)



Step7:


then on AD User2 SmartObject, execute its GetUserByGroups method (configure)


=>Click Configure>Type the Group that you want to get user from e.g Finance



=>Checking If the Field name is equal to System Name.



=> if  they are equal it must display the displayname on the list view where we dragged "Data Label" for the person who login



 


 


Step8:


=>If myData Label contains a value


=>then execute the Get List Items method  Configure (Configuration not necessary)


=>If myData Label does not contain a Value


=>then execute "Get List items" Method Configure


Click configure>Go to Filter>on Field choose Colleague> Operator choose equal sign> Value drag System Value.


Click Finish>Ok> Finish



 


Regards


Elvis





Dear Elvis

 

Thank you very much for the detailed solution. It works exactly as needed!

Because it may be difficult to understand for all other users: The "magic" is in step 7 and 8.

The trick is to use the AD-Smart Object method "GetUsersByGroups" and filter by the "current user". With this "trick" you get to know if the current user is in a given AD-Group.

  • If the result ist empty the user is not a member of the given ad-group
  • If the result is not empty the user is a member of a given AD-group

Based on this "boolean"-like result one can change the filter. Here in this example the result has been written to a data-label. But one can also use a parameter (which will be my "version").


Reply