SharePoint Office 365 External User Filter



A current project of mine has a rather routine requirement, filtering web parts on the page by the current user. This is a relatively simple requirement to fulfill in that I add a User Filter web part to the page and connect this to the other web part(s) on the page. However, Office 365 allows for this SharePoint site to be shared to outside users and that is where things became interesting.

Many people read a blog to quickly find out how to solve a problem. In respect to that, I am going to detail how I solved the problem first. Further down in the article I provide some reference and background to show how I arrived at this solution.

To filter web part(s) based on current user for external user accounts in Office 365 SharePoint:

  1.  Within your list(s), create a Person or Group column type (mine is named Account Name)
  2. Populate this column with the email address of the external user (example: externaluser@hotmail.com and check the entry)
  3. Add a User Filter web part to the page and for the Select Value to Provide, select Current User Name.
  4. Connect the User Filter to the Web Part(s) on the page with the Consumer Field Name being the column created in Step 1 (in this case Account Name)
  5. The Web Part(s) on the page are now filtered based on the current user

Reference and Background:
Let’s examine an external account that has been shared with this site. (Note: this SharePoint site has been shared with outside users by selection Site Actions and then selecting Share Site). All of the external users have Hotmail email accounts to minimize and possible issues. Next, I go to Site Actions à Site Settings à Site Permissions and select the group that my outside user accounts are a member of (in this case it is my Members group). I then select the username for one of these external accounts. Notice the account name (something similar to i:0#.f|membership|live.com#externaluser@hotmail.com. The name row is the name from the email account and then there is a Work email row which is populated with the same email account referenced in the Account row.
What does that information have to do with my user filter? In looking at the account information, I thought that I could create a column within my lists to hold the external shared account email address and then pass the work email from the user filter to this column. However, this approach did not work for me. The only way that I found this to work was to use the solution stated above. Please note that I am sure there are some scripts that can be run to do this same thing but I wanted to stay “out of the box” as much as possible with this solution.

Comments