1
votes

I am having a bit of trouble trying to access/edit Umbraco Member properties.

I have created a property in Umbraco for my members and I can set this fine using the Umbraco Backend.

However, I am trying to to access/edit these properties within my own code.

Member umbracoUser = new Member(1077);
umbracoUser.getProperty("isDisabled").Value = "1";

When assiging the value to the property I get an error saying

Object reference not set to an instance of an object.

I can get access to everything else on the umbracoUser object, such as LoginName and Email etc, but cant get the properties that I have created.

1
Does it work when you get the current Member like this: Member m = Member.GetCurrentMember();BeaverProj
No, that doesn't work either.xrisdoc
Ok, I have done a separate test for this and got it working, but still can't get it working at the point I want it to. I got it working within a UserControl/Macro on the umbraco front-end. The part I am trying to get it to work, which is where it is failing, is within a MVC3 sub-application. I have got the Umbraco Membership working with this sub-application but still cant seem to access the properties.xrisdoc
Have you included the dlls that are needed for the Member APIs? What method/package are you using to add MVC support to Umbraco 4? Have you tried asking the question over at our.umbraco.org?BeaverProj
I believe I have included the relevant dlls (cms, businesslogic, interfaces, umbraco and umbraco.providers). As I said, I have been able to use the umbraco membership for other things within my application (i.e. create/edit users etc). I'm not adding support for MVC as such, I am just running a MVC sub application within my umbraco website. However, I did have to make some amendments to the web.config file in the umbraco root directory in order to get the sub MVC application working. The amendments I made were just to stop sub application inheriting settings from the umbraco web.config. Thanksxrisdoc

1 Answers

0
votes

Is it possible to use a package like http://our.umbraco.org/projects/website-utilities/umbramvco to add MVC into Umbraco and do what you need?

Aaron Powell also has a couple of blogs on the subject:

http://www.aaron-powell.com/umbraco/using-mvc-in-umbraco-4

http://www.aaron-powell.com/umbraco/using-mvc-in-umbraco-4-revisited

Perhaps that may lead to an alternate method that could be a solution.