on 10-07-2004 1:59 AM
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.