cancel
Showing results for 
Search instead for 
Did you mean: 

PDK for .NET question

Former Member
0 Kudos

Hello

I'm trying to use the UserInfo class to get the user attributes in a portal component, but I can't instantiate the object because the compiler says that the constructor for UserInfo class takes 1 parameter, but in the online help doesn't explain how to use the constructor or which is the parameter, and also there is no sample for this assembly. The code that I'm using is:

...

#using SAP.Portal.Services.UserMAnagement;

namespace myNameSpace

{

...

public void someMethod()

{

UserInfo myUserObject = new UserInfo();

}

...

}

Has anyone a sample of how to use this class?

Regards

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Refael,

The Class <i>UserInfo</i> has no constructor and you are not supposed to create an instance of it. You can get the information of the user by using the <i>User Management</i> service. Take a look at the following:

using SAP.Portal.Services.UserManagement;

public void Method1()

{

UserManagement um = new UserManagement();

UserInfo userInfo = um.GetUser(this.User.Identity.Name);

Response.Write("User : " + userInfo.DisplayName);

}

I hope that helps.

Yossi

Former Member
0 Kudos

Yes, that is what I want to know

Thank you

Former Member
0 Kudos

I have other question, we have custom properties in our Portal for users (for example, we have a custom property called CustomerID). How can we read this custom properties using the classes provided by the PDK for VStudio.net?

Former Member
0 Kudos

Hi Rafael,

If by "custom properties" you mean personalization (user or admin) you should read the section regarding personalization in the documentation. checkout the tutorials->personalization document. You can do this in the integrated help in VS or in the online documentation in SDN (try this: https://media.sdn.sap.com/html/submitted_docs/PDK_for_dotNET_10/Tutorials/Personalization.htm).

In a nutshell, in C# you will need to write something like this to access the value:

this.Profile.Properties["CustomerID"].Value

But the PDK also helps you define and set such personalization properties.

Hope that helps,

Ofer

former_member374
Active Contributor
0 Kudos

Hi Rafael,

You are thanking a poster for his answer.

Please next time also give him points.

See: /people/mark.finnern/blog/2004/08/10/spread-the-love

This time I did it for you.

Remember: When you ask a question you also assume the responsibility to assign points.

Please check your other questions and if the answers were good. Spread the love and give some points.

Thanks in advance, Mark.

Answers (1)

Answers (1)

reiner_hille-doering
Active Contributor
0 Kudos

I'm not a portal expert, but as far as I remember there is something like "GetService", where you pass in the type of service (here "UserInfo") and would get out an instance. But's I'm sure there are samples in the documentation of the PDK.