U4-4379 - Add Umbraco.TypedMember and Umbraco.Member helper methods

Created by Jeroen Breuer 10 Mar 2014, 15:57:40 Updated by Kris Janssen 28 Feb 2017, 10:37:04

Relates to: U4-6368

For content and media you can do the following: Umbraco.TypedContent(1234) Umbraco.Content(1234) Umbraco.TypedMedia(9999) Umbraco.Media(9999)

Now that 6.2.0 and 7.1.0 have a new member api it would be nice if these helper methods would also be added so everything can be used in the same way.

Currently I still have to use library.GetMember(id) because that has a cache system.


Sebastiaan Janssen 10 Mar 2014, 16:03:28

@Shandem Good one, didn't really think about querying yet. Does the membership provider querying rely on cache? Not sure we can fit it in before the release but it would sure make the querying APIs more consistent as well.

Shannon Deminick 11 Mar 2014, 03:42:31

Ok so I've completed this. As for member caching we cannot of course cache all members as that is a very bad idea since there can be thousands of them, however we do cache members at the repository layer just like we do with content and the membership database querying is optimized. Getting members by id, etc... should be very quick and the result is cached.

I've implemented this the same way as content/media but there are some differences because members are fundamentally different. The biggest thing is that members do not have a hierarchy so if you try to use any of the methods/properties on the IPublishedContent that traverse a tree for the item returned from these methods you'll get a NotSupportedException, things such as Children, Descendants, etc...

I've left the UmbracoHelper methods to be simple, these methods are:

@Umbraco.TypedMember(string id) @Umbraco.TypedMember(int id) @Umbraco.TypedMember(object id) @Umbraco.Member(string id) @Umbraco.Member(int id) @Umbraco.Member(object id)

We expose a MembershipHelper object using the syntax @Members which expose a few other methods like:

@Members.GetById(int id) @Members.GetByProviderKey(object key) @Members.GetByUsername(string username) @Members.GetByEmail(string email)

If you want to use the dynamic instance returned by these methods you can do:


Note that these methods will throw an exception current (NotSupported) if the Umbraco membership provider is not being used.

All of these methods return IPublishedContent just like content/media so you can do things like:


which will use the property's property value converter just like content/media.

Happy days :)

Kris Janssen 28 Feb 2017, 10:37:04

Hi guys, @Shandem

If I might; these changes only allow querying of singular members. This might not be consistent with the ability to return multiple content nodes using the various helpers.

There are quite some usage scenarios where you might want to work on collections of users, e.g. to list site members publicly or have some kind of user directory.

A lot of online examples/tutorials still abuse the 'MembershipService' for this.

The only other option currently seems to be to create a custom index:


Could this be revisited in light of this at some point?

Priority: Normal

Type: Bug

State: Fixed

Assignee: Shannon Deminick

Difficulty: Normal


Backwards Compatible: True

Fix Submitted:

Affected versions: 7.1.0, 6.2.0

Due in version: 7.1.0, 6.2.0


Story Points: